summaryrefslogtreecommitdiffstats
path: root/app/login
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-11-16 14:47:53 -0800
committerGunnar Mills <gmills@us.ibm.com>2018-11-19 15:25:50 +0000
commit1c43b312769fcf9fe4e41bf6d7336402d06bed6e (patch)
tree8ea02e61986ad3ac6f7d6f6f057d1ee99e181f9e /app/login
parent0ad2604b95d9bd19dcb502106ee2ff98229097c0 (diff)
downloadphosphor-webui-1c43b312769fcf9fe4e41bf6d7336402d06bed6e.tar.gz
phosphor-webui-1c43b312769fcf9fe4e41bf6d7336402d06bed6e.zip
phosphor-webui: Allow after login redirects
When redirecting a user to a login url, it is helpful to be able to point them to a url that after login, will forward to the requested page. This is accomplished by the use of a url param named "next" which specifies the URL that the user wants to be redirected to after login. If no next url is specified, the user is redirected to the overview page, like the vehavior before. Change-Id: Iff0da65632119a8f7ae3f35eb74147ca67563f30 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'app/login')
-rw-r--r--app/login/controllers/login-controller.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/app/login/controllers/login-controller.js b/app/login/controllers/login-controller.js
index 8877df7..e31a67e 100644
--- a/app/login/controllers/login-controller.js
+++ b/app/login/controllers/login-controller.js
@@ -10,8 +10,12 @@ window.angular && (function(angular) {
'use strict';
angular.module('app.login').controller('LoginController', [
- '$scope', '$window', 'dataService', 'userModel',
- function($scope, $window, dataService, userModel) {
+ '$scope',
+ '$window',
+ 'dataService',
+ 'userModel',
+ '$location',
+ function($scope, $window, dataService, userModel, $location) {
$scope.dataService = dataService;
$scope.host = $scope.dataService.host.replace(/^https?\:\/\//ig, '');
@@ -34,7 +38,12 @@ window.angular && (function(angular) {
userModel.login(username, password, function(status, description) {
if (status) {
$scope.$emit('user-logged-in', {});
- $window.location.hash = '#/overview/server';
+ var next = $location.search().next;
+ if (next === undefined || next == null) {
+ $window.location.hash = '#/overview/server';
+ } else {
+ $window.location.href = next;
+ }
} else {
$scope.error = true;
if (description) {
@@ -44,6 +53,6 @@ window.angular && (function(angular) {
});
}
};
- }
+ },
]);
})(angular);
OpenPOWER on IntegriCloud