From c9b7cb58c94d6a2044cff699308ed7aa96ad6829 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Tue, 30 Jun 2020 15:42:14 +0200 Subject: [PATCH] #1420 No longer rely on JS and XHR to handle the SSO redirections --- .../scripts/controllers/AuthenticationCtrl.js | 28 ------------------- .../scripts/services/api/AuthenticationSrv.js | 4 --- frontend/app/styles/main.css | 21 ++++++++++++++ frontend/app/views/login.html | 17 +++++------ 4 files changed, 30 insertions(+), 40 deletions(-) diff --git a/frontend/app/scripts/controllers/AuthenticationCtrl.js b/frontend/app/scripts/controllers/AuthenticationCtrl.js index 84a79eb809..22e675e7c6 100644 --- a/frontend/app/scripts/controllers/AuthenticationCtrl.js +++ b/frontend/app/scripts/controllers/AuthenticationCtrl.js @@ -11,28 +11,6 @@ $uibModalStack.dismissAll(); - $scope.ssoLogin = function (code, state) { - AuthenticationSrv.ssoLogin(code, state) - .then(function(response) { - var redirectLocation = response.headers().location; - if(angular.isDefined(redirectLocation)) { - window.location = redirectLocation; - } else { - $rootScope.isLoading = true; - // Simple redirect to remove oauth2 query strings from url (before hash) - window.location.replace(window.location.origin + window.location.pathname); - } - }) - .catch(function(err) { - if (err.status === 520) { - NotificationSrv.error('AuthenticationCtrl', err.data, err.status); - } else { - NotificationSrv.log(err.data.message, 'error'); - } - $location.url($location.path()); - }); - }; - $scope.ssoEnabled = function() { return appConfig.config.authType.indexOf("oauth2") !== -1; }; @@ -54,11 +32,5 @@ } }); }; - - var code = UtilsSrv.extractQueryParam('code', UrlParser('query', $location.absUrl())); - var state = UtilsSrv.extractQueryParam('state', UrlParser('query', $location.absUrl())); - if((angular.isDefined(code) && angular.isDefined(state)) || $stateParams.autoLogin) { - $scope.ssoLogin(code, state); - } }); })(); diff --git a/frontend/app/scripts/services/api/AuthenticationSrv.js b/frontend/app/scripts/services/api/AuthenticationSrv.js index 1ab6a927b0..6155d6dfee 100644 --- a/frontend/app/scripts/services/api/AuthenticationSrv.js +++ b/frontend/app/scripts/services/api/AuthenticationSrv.js @@ -62,10 +62,6 @@ return $q.reject(err); }); }, - ssoLogin: function(code, state) { - var url = angular.isDefined(code) && angular.isDefined(state) ? './api/ssoLogin?code=' + code + '&state=' + state : './api/ssoLogin'; - return $http.post(url, {}); - }, isSuperAdmin: function() { var user = self.currentUser; diff --git a/frontend/app/styles/main.css b/frontend/app/styles/main.css index 3fefe15560..4d5806ba7f 100644 --- a/frontend/app/styles/main.css +++ b/frontend/app/styles/main.css @@ -131,6 +131,7 @@ pre.clearpre { width: 50%; } +/** Login page **/ .login-form { width: 600px; margin: auto; @@ -138,6 +139,26 @@ pre.clearpre { background-color: #eee; } +.or-separator { + display: flex; + align-items: center; + text-align: center; + color: #afafaf; +} +.or-separator::before, +.or-separator::after { + content: ''; + flex: 1; + border-bottom: 1px solid #cfcfcf; +} +.or-separator::before { + margin-right: .25em; +} +.or-separator::after { + margin-left: .25em; +} +/***************************/ + .flexwrap { display: flex; flex-wrap: wrap; diff --git a/frontend/app/views/login.html b/frontend/app/views/login.html index 16656c0f0d..f31da6bdf3 100644 --- a/frontend/app/views/login.html +++ b/frontend/app/views/login.html @@ -23,20 +23,21 @@ -
- - -
-
-
- + +
+
OR
+ +
-
+
+