From c25c9d5902a7a674061511857bddcf7ce982f344 Mon Sep 17 00:00:00 2001 From: Adam Abdelaziz Date: Wed, 20 Sep 2017 17:13:22 -0400 Subject: [PATCH] Update routing and begin work on confirmation pages --- .../mnoe-api/current-user.svc.coffee | 11 - src/app/index.less | 2 +- src/app/index.route.coffee | 4 +- .../confirmation/confirm.controller.coffee | 17 + src/app/views/auth/confirmation/confirm.html | 306 ++++++++++++++ .../auth/confirmation/confirm_original.html | 374 ++++++++++++++++++ src/app/views/layout.controller.coffee | 6 +- .../public/landing/landing.controller.coffee | 2 +- src/app/views/public/public.controller.coffee | 5 +- src/app/views/public/public.html | 17 +- src/locales/en.json | 3 +- 11 files changed, 718 insertions(+), 29 deletions(-) create mode 100644 src/app/views/auth/confirmation/confirm.controller.coffee create mode 100644 src/app/views/auth/confirmation/confirm.html create mode 100644 src/app/views/auth/confirmation/confirm_original.html diff --git a/src/app/components/mnoe-api/current-user.svc.coffee b/src/app/components/mnoe-api/current-user.svc.coffee index bedea32d..4532728b 100644 --- a/src/app/components/mnoe-api/current-user.svc.coffee +++ b/src/app/components/mnoe-api/current-user.svc.coffee @@ -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 @ diff --git a/src/app/index.less b/src/app/index.less index 4d6007a9..169db2c4 100644 --- a/src/app/index.less +++ b/src/app/index.less @@ -39,7 +39,7 @@ body { } } -.myspace { +.myspace, .page-wrapper { background-color: @dashboard-bg-color; min-height:100%; } diff --git a/src/app/index.route.coffee b/src/app/index.route.coffee index c61d9b2e..709ea417 100644 --- a/src/app/index.route.coffee +++ b/src/app/index.route.coffee @@ -276,16 +276,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( diff --git a/src/app/views/auth/confirmation/confirm.controller.coffee b/src/app/views/auth/confirmation/confirm.controller.coffee new file mode 100644 index 00000000..c5b4ecdf --- /dev/null +++ b/src/app/views/auth/confirmation/confirm.controller.coffee @@ -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 + ) diff --git a/src/app/views/auth/confirmation/confirm.html b/src/app/views/auth/confirmation/confirm.html new file mode 100644 index 00000000..71ce1641 --- /dev/null +++ b/src/app/views/auth/confirmation/confirm.html @@ -0,0 +1,306 @@ +
+
+
+
+ +
+
+
+
diff --git a/src/app/views/auth/confirmation/confirm_original.html b/src/app/views/auth/confirmation/confirm_original.html new file mode 100644 index 00000000..78d24537 --- /dev/null +++ b/src/app/views/auth/confirmation/confirm_original.html @@ -0,0 +1,374 @@ + + + + My Company + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/views/layout.controller.coffee b/src/app/views/layout.controller.coffee index de1c41b3..7d0b3e70 100644 --- a/src/app/views/layout.controller.coffee +++ b/src/app/views/layout.controller.coffee @@ -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 @@ -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) @@ -34,7 +34,7 @@ angular.module 'mnoEnterpriseAngular' -> # Allow child state to load $rootScope.resourcesLoaded.resolve() - + # Display the layout $rootScope.isLoggedIn = true diff --git a/src/app/views/public/landing/landing.controller.coffee b/src/app/views/public/landing/landing.controller.coffee index 8ed0a6a8..51a92652 100644 --- a/src/app/views/public/landing/landing.controller.coffee +++ b/src/app/views/public/landing/landing.controller.coffee @@ -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 diff --git a/src/app/views/public/public.controller.coffee b/src/app/views/public/public.controller.coffee index ed3eef30..27a4dc77 100644 --- a/src/app/views/public/public.controller.coffee +++ b/src/app/views/public/public.controller.coffee @@ -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) -> diff --git a/src/app/views/public/public.html b/src/app/views/public/public.html index 253bbd8e..e02c4171 100644 --- a/src/app/views/public/public.html +++ b/src/app/views/public/public.html @@ -1,12 +1,17 @@
diff --git a/src/locales/en.json b/src/locales/en.json index 61d10812..a58fd5c3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -872,7 +872,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", @@ -1174,7 +1174,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?",