diff --git a/src/app/controllers/loginCtrl.js b/src/app/controllers/loginCtrl.js index 45d24987ca1..c3696d55124 100644 --- a/src/app/controllers/loginCtrl.js +++ b/src/app/controllers/loginCtrl.js @@ -7,7 +7,7 @@ function (angular, config) { var module = angular.module('grafana.controllers'); - module.controller('LoginCtrl', function($scope, backendSrv, $location, $routeParams, alertSrv) { + module.controller('LoginCtrl', function($scope, backendSrv, $location, $routeParams) { $scope.formModel = { user: '', @@ -82,7 +82,6 @@ function (angular, config) { $scope.logout = function() { backendSrv.post('/logout').then(function() { - alertSrv.set('Logged out!', '', 'success', 3000); $scope.appEvent('logged-out'); $location.search({}); }); @@ -95,8 +94,13 @@ function (angular, config) { return; } - backendSrv.post('/login', $scope.formModel).then(function() { - window.location.href = config.appSubUrl + '/'; + backendSrv.post('/login', $scope.formModel).then(function(result) { + if (result.redirectUrl) { + console.log(result); + window.location.href = result.redirectUrl; + } else { + window.location.href = config.appSubUrl + '/'; + } }); }; diff --git a/src/app/partials/login.html b/src/app/partials/login.html index 4c70be392af..d96b4d1f952 100644 --- a/src/app/partials/login.html +++ b/src/app/partials/login.html @@ -23,7 +23,7 @@ User