Skip to content

Commit

Permalink
Update routing and begin work on confirmation pages
Browse files Browse the repository at this point in the history
  • Loading branch information
adamaziz15 committed Sep 20, 2017
1 parent 1ae63c1 commit 7d6001e
Show file tree
Hide file tree
Showing 11 changed files with 709 additions and 25 deletions.
11 changes: 0 additions & 11 deletions src/app/components/mnoe-api/current-user.svc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,4 @@ angular.module 'mnoEnterpriseAngular'
@updatePassword = (passwordData) ->
MnoeApiSvc.all('/current_user').doPUT({user: passwordData}, 'update_password')

# Ensure user is logged in
@loginRequired = ->
_self.get().then(
(response) ->
unless response.logged_in
if MnoeConfig.arePublicApplicationsEnabled()
$state.go('public.landing')
else
$window.location = URI.login
)

return @
2 changes: 1 addition & 1 deletion src/app/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ body {
}
}

.myspace {
.myspace, .page-wrapper {
background-color: @dashboard-bg-color;
min-height:100%;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/index.route.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,16 @@ angular.module 'mnoEnterpriseAngular'
MnoeCurrentUser = $injector.get('MnoeCurrentUser')
MnoeOrganizations = $injector.get('MnoeOrganizations')
MnoeAppInstances = $injector.get('MnoeAppInstances')
$window = $injector.get('$window')

MnoeCurrentUser.get().then(
(response) ->
# Same as MnoeCurrentUser.loginRequired
debugger
unless response.logged_in
if MnoeConfig.arePublicApplicationsEnabled()
$location.url('/landing')
else
$window.location = URI.login
$location.url('/login')
else
if MnoeConfig.isOnboardingWizardEnabled()
MnoeOrganizations.getCurrentOrganisation().then(
Expand Down
17 changes: 17 additions & 0 deletions src/app/views/auth/confirmation/confirm.controller.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
angular.module 'mnoEnterpriseAngular'
.controller('AuthConfirmCtrl',
($state, $stateParams, MnoeAuthSvc, toastr, MnoErrorsHandler) ->
vm = @
vm.user = {phone_country_code: "US", confirmation_token: $stateParams.confirmation_token}

MnoeAuthSvc.one("/users/confirmation").get({confirmation_token: vm.user.confirmation_token}).then(
->
debugger
(error) ->
debugger
)

vm.confirmUser = ->

return
)
306 changes: 306 additions & 0 deletions src/app/views/auth/confirmation/confirm.html

Large diffs are not rendered by default.

374 changes: 374 additions & 0 deletions src/app/views/auth/confirmation/confirm_original.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/app/views/layout.controller.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module 'mnoEnterpriseAngular'
.controller 'LayoutController', ($scope, $rootScope, $stateParams, $state, $q, $timeout, AnalyticsSvc, MnoeCurrentUser, MnoeOrganizations,
MnoeMarketplace, MnoeAppInstances, ONBOARDING_WIZARD_CONFIG) ->
MnoeMarketplace, MnoeAppInstances, MnoeConfig) ->
'ngInject'

layout = this
Expand All @@ -21,7 +21,7 @@ angular.module 'mnoEnterpriseAngular'
# App instances needs to be run after fetching the organization (At least the first call)
MnoeAppInstances.getAppInstances().then(
(appInstances) ->
if ONBOARDING_WIZARD_CONFIG.enabled && _.isEmpty(appInstances)
if MnoeConfig.isOnboardingWizardEnabled() && _.isEmpty(appInstances)
$state.go('onboarding.step1')

layout.appInstancesDeferred.resolve(appInstances)
Expand All @@ -34,7 +34,7 @@ angular.module 'mnoEnterpriseAngular'
->
# Allow child state to load
$rootScope.resourcesLoaded.resolve()

# Display the layout
$rootScope.isLoggedIn = true

Expand Down
2 changes: 1 addition & 1 deletion src/app/views/public/landing/landing.controller.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module 'mnoEnterpriseAngular'
.controller('LandingCtrl',
($scope, $rootScope, $state, $stateParams, $window, MnoeConfig, MnoeMarketplace, URI) ->
($scope, $rootScope, $state, $stateParams, $window, $translate, MnoeConfig, MnoeMarketplace, URI) ->

vm = @
vm.isLoading = true
Expand Down
5 changes: 2 additions & 3 deletions src/app/views/public/public.controller.coffee
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
angular.module 'mnoEnterpriseAngular'
.controller 'PublicController', ($scope, $rootScope, $stateParams, $state, $q, $window, URI, MnoeCurrentUser, MnoeOrganizations, MnoeConfig) ->
.controller 'PublicController', ($scope, $rootScope, $stateParams, $state, $q, URI, MnoeCurrentUser, MnoeOrganizations, MnoeConfig) ->
'ngInject'

layout = @
layout.links = URI

layout.isRegistrationEnabled = MnoeConfig.isRegistrationEnabled()

$window.location = URI.login unless MnoeConfig.arePublicApplicationsEnabled()
$state.go('login') unless MnoeConfig.arePublicApplicationsEnabled()

MnoeCurrentUser.get().then(
(response) ->
Expand Down
4 changes: 2 additions & 2 deletions src/app/views/public/public.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</div>
</div>
<div class="links pull-right">
<a ng-if="layout.isRegistrationEnabled" href="{{layout.links.signup}}" class="btn btn-default pull-right">Sign-up</a>
<a href="{{layout.links.login}}" class="btn btn-default pull-right">Login</a>
<a ng-if="layout.isRegistrationEnabled" ui-sref="signup" class="btn btn-default pull-right">Sign-up</a>
<a ui-sref="login" class="btn btn-default pull-right">Login</a>
</div>
</div>
</nav>
Expand Down
3 changes: 1 addition & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@
"mno_enterprise.templates.dashboard.account.personal_information": "Personal Information",
"mno_enterprise.templates.dashboard.account.user_form_name": "Name",
"mno_enterprise.templates.dashboard.account.user_form_surname": "Surname",
"mno_enterprise.templates.dashboard.account.us`er_form_email": "Email",
"mno_enterprise.templates.dashboard.account.user_form_email": "Email",
"mno_enterprise.templates.dashboard.account.user_form_phone": "Phone",
"mno_enterprise.templates.dashboard.account.user_form_save": "Save",
"mno_enterprise.templates.dashboard.account.user_form_cancel": "Cancel",
Expand Down Expand Up @@ -1161,7 +1161,6 @@
"mno_enterprise.auth.registrations.new.tos": "the Terms of Use",
"mno_enterprise.auth.sessions.new.title": "Sign In",
"mno_enterprise.auth.sessions.new.sign_in": "Sign in",
"mno_enterprise.auth.sessions.new.remember_me": "Remember me",
"mno_enterprise.auth.shared.links.login": "Already have an account? Log in",
"mno_enterprise.auth.shared.links.signup": "Don't have an account? Sign up",
"mno_enterprise.auth.shared.links.recover_password": "Forgot your password?",
Expand Down

0 comments on commit 7d6001e

Please sign in to comment.