From 794e0e03260fb646f5fff41ccc3ca4ecaa7adc7d Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 21 Jan 2022 14:33:15 +0000 Subject: [PATCH] Delete old login modal code --- .../forgot_controller.js.coffee | 19 ------- .../authentication/login_controller.js.coffee | 36 ------------ .../signup_controller.js.coffee | 17 ------ .../authentication_controller.js.coffee | 12 ---- .../services/authentication_service.js.coffee | 57 ------------------- .../darkswarm/services/redirections.js.coffee | 3 - .../templates/authentication.html.haml | 7 --- .../javascripts/templates/forgot.html.haml | 31 ---------- .../javascripts/templates/login.html.haml | 44 -------------- .../registration_authentication.html.haml | 17 ------ .../javascripts/templates/signup.html.haml | 51 ----------------- .../cookies_banner_service.js.coffee | 3 +- 12 files changed, 1 insertion(+), 296 deletions(-) delete mode 100644 app/assets/javascripts/darkswarm/controllers/authentication/forgot_controller.js.coffee delete mode 100644 app/assets/javascripts/darkswarm/controllers/authentication/login_controller.js.coffee delete mode 100644 app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee delete mode 100644 app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee delete mode 100644 app/assets/javascripts/darkswarm/services/authentication_service.js.coffee delete mode 100644 app/assets/javascripts/darkswarm/services/redirections.js.coffee delete mode 100644 app/assets/javascripts/templates/authentication.html.haml delete mode 100644 app/assets/javascripts/templates/forgot.html.haml delete mode 100644 app/assets/javascripts/templates/login.html.haml delete mode 100644 app/assets/javascripts/templates/registration_authentication.html.haml delete mode 100644 app/assets/javascripts/templates/signup.html.haml diff --git a/app/assets/javascripts/darkswarm/controllers/authentication/forgot_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication/forgot_controller.js.coffee deleted file mode 100644 index 8a0a2121de..0000000000 --- a/app/assets/javascripts/darkswarm/controllers/authentication/forgot_controller.js.coffee +++ /dev/null @@ -1,19 +0,0 @@ -angular.module('Darkswarm').controller "ForgotCtrl", ($scope, $http, $location, AuthenticationService) -> - $scope.path = "/forgot" - $scope.sent = false - - $scope.submit = -> - if $scope.spree_user.email != null - $http.post("/user/spree_user/password", {spree_user: $scope.spree_user}).then (response)-> - $scope.sent = true - .catch (response) -> - $scope.errors = response.data.error - $scope.user_unconfirmed = (response.status == 401) - else - $scope.errors = t 'email_required' - - $scope.resend_confirmation = -> - $http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).then (response)-> - $scope.messages = t('devise.confirmations.send_instructions') - .catch (response) -> - $scope.errors = t('devise.confirmations.failed_to_send') diff --git a/app/assets/javascripts/darkswarm/controllers/authentication/login_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication/login_controller.js.coffee deleted file mode 100644 index 63dfb719b4..0000000000 --- a/app/assets/javascripts/darkswarm/controllers/authentication/login_controller.js.coffee +++ /dev/null @@ -1,36 +0,0 @@ -angular.module('Darkswarm').controller "LoginCtrl", ($scope, $timeout, $location, $http, $window, AuthenticationService, Redirections, Loading) -> - $scope.path = "/login" - - $scope.modalMessage = null - - $scope.$watch (-> - AuthenticationService.modalMessage - ), (newValue) -> - $scope.errors = newValue - - $scope.submit = -> - Loading.message = t 'logging_in' - $http.post("/user/spree_user/sign_in", {spree_user: $scope.spree_user}).then (response)-> - if window._paq - window._paq.push(['trackEvent', 'Signin/Signup', 'Login Submit Success', $location.absUrl()]); - if Redirections.after_login - $window.location.href = $window.location.origin + Redirections.after_login - else - $window.location.href = $window.location.origin + $window.location.pathname # Strips out hash fragments - .catch (response) -> - Loading.clear() - $scope.errors = response.data.message || response.data.error - $scope.user_unconfirmed = (response.data.error == t('devise.failure.unconfirmed')) - - $scope.resend_confirmation = -> - $http.post("/user/spree_user/confirmation", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).then (response)-> - $scope.messages = t('devise.confirmations.send_instructions') - .catch (response) -> - $scope.errors = t('devise.confirmations.failed_to_send') - - $timeout -> - if angular.isDefined($location.search()['validation']) - if $location.search()['validation'] == 'confirmed' - $scope.messages = t('devise.confirmations.confirmed') - if $location.search()['validation'] == 'not_confirmed' - $scope.errors = t('devise.confirmations.not_confirmed') diff --git a/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee deleted file mode 100644 index 7c742b91f8..0000000000 --- a/app/assets/javascripts/darkswarm/controllers/authentication/signup_controller.js.coffee +++ /dev/null @@ -1,17 +0,0 @@ -angular.module('Darkswarm').controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) -> - $scope.path = "/signup" - - $scope.spree_user.password_confirmation = '' - - $scope.errors = - email: null - password: null - - $scope.submit = -> - $http.post("/user/spree_user", {spree_user: $scope.spree_user, return_url: $location.absUrl()}).then (response)-> - $scope.errors = {email: null, password: null} - $scope.messages = t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') - if window._paq - window._paq.push(['trackEvent', 'Signin/Signup', 'Signup Submit Success', $location.absUrl()]); - .catch (response) -> - $scope.errors = response.data diff --git a/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee deleted file mode 100644 index 689048722d..0000000000 --- a/app/assets/javascripts/darkswarm/controllers/authentication_controller.js.coffee +++ /dev/null @@ -1,12 +0,0 @@ -angular.module('Darkswarm').controller "AuthenticationCtrl", ($scope, AuthenticationService, SpreeUser)-> - $scope.open = AuthenticationService.open - $scope.toggle = AuthenticationService.toggle - - $scope.spree_user = SpreeUser.spree_user - $scope.isActive = AuthenticationService.isActive - $scope.select = AuthenticationService.select - - $scope.tabs = - login: { active: $scope.isActive('/login') } - signup: { active: $scope.isActive('/signup') } - forgot: { active: $scope.isActive('/forgot') } diff --git a/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee b/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee deleted file mode 100644 index 7c5711d992..0000000000 --- a/app/assets/javascripts/darkswarm/services/authentication_service.js.coffee +++ /dev/null @@ -1,57 +0,0 @@ -# This class deals with displaying things in the login modal. It chooses -# the modal tab templates and deals with switching tabs and passing data -# between the tabs. It has direct access to the instance of the login modal, -# and provides that access to other controllers as a service. - -angular.module('Darkswarm').factory "AuthenticationService", (Navigation, $modal, $location, Redirections, Loading)-> - - new class AuthenticationService - selectedPath: "/login" - modalMessage: null - - constructor: -> - if $location.path() in ["/login", "/signup", "/forgot"] || location.pathname is '/register/auth' - @open @initialTab(), @initialTemplate() - - open: (path = false, template = 'authentication.html') => - @modalInstance = $modal.open - templateUrl: template - windowClass: "login-modal medium" - @modalInstance.result.then @close, @close - @selectedPath = path || @selectedPath - Navigation.navigate @selectedPath - - if window._paq - window._paq.push(['trackEvent', 'Signin/Signup', 'Login Modal View', window.location.href]) - - # Opens the /login tab if returning from email confirmation, - # the /signup tab if opened from the enterprise registration page, - # otherwise opens whichever tab is selected in the URL params ('/login', '/signup', or '/forgot') - initialTab: -> - if angular.isDefined($location.search()['validation']) - '/login' - else if location.pathname is '/register/auth' - '/signup' - else - $location.path() - - # Loads the registration page modal when needed, otherwise the default modal - initialTemplate: -> - if location.pathname is '/register/auth' - 'registration_authentication.html' - else - 'authentication.html' - pushMessage: (message) -> - @modalMessage = String(message) - - select: (path)=> - @selectedPath = path - Navigation.navigate @selectedPath - - isActive: Navigation.isActive - - close: -> - if location.pathname in ["/register", "/register/auth"] - Loading.message = t 'going_back_to_home_page' - location.hash = "" - location.pathname = "/" diff --git a/app/assets/javascripts/darkswarm/services/redirections.js.coffee b/app/assets/javascripts/darkswarm/services/redirections.js.coffee deleted file mode 100644 index a2950b123a..0000000000 --- a/app/assets/javascripts/darkswarm/services/redirections.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -angular.module('Darkswarm').factory "Redirections", ($location)-> - new class Redirections - after_login: $location.search().after_login diff --git a/app/assets/javascripts/templates/authentication.html.haml b/app/assets/javascripts/templates/authentication.html.haml deleted file mode 100644 index db1b5ecd7d..0000000000 --- a/app/assets/javascripts/templates/authentication.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%div{"ng-controller" => "AuthenticationCtrl"} - %tabset - %ng-include{src: "'login.html'"} - %ng-include{src: "'signup.html'"} - %ng-include{src: "'forgot.html'"} -%a.close-reveal-modal{"ng-click" => "$close()"} - %i.ofn-i_009-close diff --git a/app/assets/javascripts/templates/forgot.html.haml b/app/assets/javascripts/templates/forgot.html.haml deleted file mode 100644 index 94e85af2bc..0000000000 --- a/app/assets/javascripts/templates/forgot.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -%tab#forgot{ heading: "{{'forgot_password' | t}}", active: "tabs.forgot.active", select: "select(path)"} - %form{ ng: { controller: "ForgotCtrl", submit: "submit()" } } - .row - .large-12.columns - .alert-box.success{"ng-show" => "sent"} - {{ 'password_reset_sent' | t }} - - .alert-box.success{"ng-show" => "messages != null"} - {{ messages }} - - .alert-box.alert{"ng-show" => "errors != null"} - {{ errors }} - %a{ng: {show: 'user_unconfirmed', click: 'resend_confirmation()'}} - = t('devise.confirmations.resend_confirmation_email') - - .row - .large-12.columns - %label{for: "email"} {{'signup_email' | t}} - %input.title.input-text{name: "email", - type: "email", - id: "email", - tabindex: 1, - inputmode: "email", - "ng-model" => "spree_user.email"} - .row - .large-12.columns - %input.button.primary{name: "commit", - tabindex: "3", - type: "submit", - value: "{{'reset_password' | t}}"} - diff --git a/app/assets/javascripts/templates/login.html.haml b/app/assets/javascripts/templates/login.html.haml deleted file mode 100644 index 7ca17bfbe9..0000000000 --- a/app/assets/javascripts/templates/login.html.haml +++ /dev/null @@ -1,44 +0,0 @@ -%tab#login-content{ heading: "{{'label_login' | t}}", active: "tabs.login.active", select: "select(path)"} - %form{ ng: { controller: "LoginCtrl", submit: "submit()" } } - .row - .large-12.columns - .alert-box.alert{"ng-show" => "errors != null"} - {{ errors }} - %a{ng: {show: 'user_unconfirmed', click: 'resend_confirmation()'}} - = t('devise.confirmations.resend_confirmation_email') - .alert-box.success{ng: {show: 'messages != null'}} - {{ messages }} - .row - .large-12.columns - %label{for: "email"} {{'email' | t}} - %input.title.input-text{name: "email", - type: "email", - id: "email", - tabindex: "1", - inputmode: "email", - "ng-model" => "spree_user.email"} - .row - .large-12.columns - %label{for: "password"} {{'password' | t}} - %input.title.input-text{name: "password", - type: "password", - id: "password", - autocomplete: "off", - tabindex: "2", - inputmode: "password", - "ng-model" => "spree_user.password"} - .row - .large-12.columns - %input{name: "remember_me", - type: "checkbox", - id: "remember_me", - value: "1", - tabindex: "3", - "ng-model" => "spree_user.remember_me"} - %label{for: "remember_me"} {{'remember_me' | t}} - .row - .large-12.columns - %input.button.primary{name: "commit", - tabindex: "4", - type: "submit", - value: "{{'label_login' | t}}"} diff --git a/app/assets/javascripts/templates/registration_authentication.html.haml b/app/assets/javascripts/templates/registration_authentication.html.haml deleted file mode 100644 index b5a525c3f2..0000000000 --- a/app/assets/javascripts/templates/registration_authentication.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.container - .row.modal-centered - %h2 {{'js.registration.welcome_to_ofn' | t}} - %h5 {{'js.registration.signup_or_login' | t}}: - %div{"ng-controller" => "AuthenticationCtrl"} - %tabset - %ng-include{src: "'signup.html'"} - %ng-include{src: "'login.html'"} - %ng-include{src: "'forgot.html'"} - %div{ ng: { show: "active('/signup')"} } - %hr - {{'js.registration.have_an_account' | t}} - %a{ href: "", ng: { click: "select('/login')"}} - {{'js.registration.action_login' | t}} - -%a.close-reveal-modal{"ng-click" => "$close()"} - %i.ofn-i_009-close diff --git a/app/assets/javascripts/templates/signup.html.haml b/app/assets/javascripts/templates/signup.html.haml deleted file mode 100644 index 4ee026adb5..0000000000 --- a/app/assets/javascripts/templates/signup.html.haml +++ /dev/null @@ -1,51 +0,0 @@ -%tab#sign-up-content{ heading: "{{'label_signup' | t}}", active: 'tabs.signup.active', select: "select(path)"} - %form{ ng: { controller: "SignupCtrl", submit: "submit()" } } - .row - .large-12.columns - .alert-box.success{ng: {show: 'messages != null'}} - {{ messages }} - .large-12.columns - .alert-box.alert{ng: {show: 'errors.message != null'}} - {{ errors.message }} - .row - .large-12.columns - %label{for: "email"} {{'signup_email' | t}} - %input.title.input-text{name: "email", - type: "email", - id: "email", - tabindex: 1, - inputmode: "email", - "ng-model" => "spree_user.email"} - %span.error{"ng-show" => "errors.email != null"} - {{ errors.email.join(' ') }} - .row - .large-12.columns - %label{for: "password"} {{'choose_password' | t}} - %input.title.input-text{name: "password", - type: "password", - id: "password", - autocomplete: "off", - tabindex: 2, - inputmode: "password", - "ng-model" => "spree_user.password"} - %span.error{"ng-show" => "errors.password != null"} - {{ errors.password.join(' ') }} - .row - .large-12.columns - %label{for: "password_confirmation"} {{'confirm_password' | t}} - %input.title.input-text{name: "password_confirmation", - type: "password", - id: "password_confirmation", - autocomplete: "off", - tabindex: 2, - inputmode: "password", - "ng-model" => "spree_user.password_confirmation"} - %span.error{"ng-show" => "errors.password_confirmation != null"} - {{ errors.password_confirmation.join(' ') }} - .row - .large-12.columns - %input.button.primary{name: "commit", - tabindex: "3", - type: "submit", - value: "{{'action_signup' | t}}"} - diff --git a/engines/web/app/assets/javascripts/web/cookies_banner/cookies_banner_service.js.coffee b/engines/web/app/assets/javascripts/web/cookies_banner/cookies_banner_service.js.coffee index 2fd9fbb4c7..079d3206c8 100644 --- a/engines/web/app/assets/javascripts/web/cookies_banner/cookies_banner_service.js.coffee +++ b/engines/web/app/assets/javascripts/web/cookies_banner/cookies_banner_service.js.coffee @@ -1,5 +1,4 @@ -angular.module('Darkswarm').factory "CookiesBannerService", (Navigation, $modal, $location, Redirections, Loading)-> - +angular.module('Darkswarm').factory "CookiesBannerService", (Navigation, $modal, $location, Loading)-> new class CookiesBannerService modalMessage: null isEnabled: false