Browse Source
[3.0] Added possibility to login by url params (#2592)
* Added possibility to login by url params
* Fixes after code review
pull/2604/head
VoBa
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
1 deletions
-
ui-ngx/src/app/modules/login/pages/login/login.component.ts
|
|
|
@ -23,6 +23,7 @@ import { FormBuilder } from '@angular/forms'; |
|
|
|
import { HttpErrorResponse } from '@angular/common/http'; |
|
|
|
import { Constants } from '@shared/models/constants'; |
|
|
|
import { Router } from '@angular/router'; |
|
|
|
import { ActivatedRoute } from "@angular/router"; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'tb-login', |
|
|
|
@ -39,11 +40,16 @@ export class LoginComponent extends PageComponent implements OnInit { |
|
|
|
constructor(protected store: Store<AppState>, |
|
|
|
private authService: AuthService, |
|
|
|
public fb: FormBuilder, |
|
|
|
private router: Router) { |
|
|
|
private router: Router, |
|
|
|
private route: ActivatedRoute) { |
|
|
|
super(store); |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
if (this.route.snapshot.queryParams["username"] && this.route.snapshot.queryParams["password"]) { |
|
|
|
this.loginFormGroup.setValue({username: this.route.snapshot.queryParams["username"], password: this.route.snapshot.queryParams["password"]}); |
|
|
|
this.login(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
login(): void { |
|
|
|
|