Browse Source
[2.5] Added possibility to login by url params (#2581)
* Added possibility to login by url params
* Changes after code review
pull/2602/head
VoBa
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
2 deletions
-
ui/src/app/login/login.controller.js
-
ui/src/app/login/login.routes.js
|
|
|
@ -20,7 +20,7 @@ import logoSvg from '../../svg/logo_title_white.svg'; |
|
|
|
/* eslint-enable import/no-unresolved, import/default */ |
|
|
|
|
|
|
|
/*@ngInject*/ |
|
|
|
export default function LoginController(toast, loginService, userService, types, $state/*, $rootScope, $log, $translate*/) { |
|
|
|
export default function LoginController(toast, loginService, userService, types, $state, $stateParams/*, $rootScope, $log, $translate*/) { |
|
|
|
var vm = this; |
|
|
|
|
|
|
|
vm.logoSvg = logoSvg; |
|
|
|
@ -32,6 +32,12 @@ export default function LoginController(toast, loginService, userService, types, |
|
|
|
|
|
|
|
vm.login = login; |
|
|
|
|
|
|
|
if ($stateParams.username && $stateParams.password) { |
|
|
|
vm.user.name = $stateParams.username; |
|
|
|
vm.user.password = $stateParams.password; |
|
|
|
doLogin(); |
|
|
|
} |
|
|
|
|
|
|
|
function doLogin() { |
|
|
|
loginService.login(vm.user).then(function success(response) { |
|
|
|
var token = response.data.token; |
|
|
|
|
|
|
|
@ -25,7 +25,7 @@ import createPasswordTemplate from './create-password.tpl.html'; |
|
|
|
/*@ngInject*/ |
|
|
|
export default function LoginRoutes($stateProvider) { |
|
|
|
$stateProvider.state('login', { |
|
|
|
url: '/login', |
|
|
|
url: '/login?username&password', |
|
|
|
module: 'public', |
|
|
|
views: { |
|
|
|
"@": { |
|
|
|
|