Commit cc123a9e67fd219ae9260784c0533f4612773ba3
Committed by
GitHub
1 parent
359c4423
[3.0] Added possibility to login by url params (#2592)
* Added possibility to login by url params * Fixes after code review
Showing
1 changed file
with
7 additions
and
1 deletions
... | ... | @@ -23,6 +23,7 @@ import { FormBuilder } from '@angular/forms'; |
23 | 23 | import { HttpErrorResponse } from '@angular/common/http'; |
24 | 24 | import { Constants } from '@shared/models/constants'; |
25 | 25 | import { Router } from '@angular/router'; |
26 | +import { ActivatedRoute } from "@angular/router"; | |
26 | 27 | |
27 | 28 | @Component({ |
28 | 29 | selector: 'tb-login', |
... | ... | @@ -39,11 +40,16 @@ export class LoginComponent extends PageComponent implements OnInit { |
39 | 40 | constructor(protected store: Store<AppState>, |
40 | 41 | private authService: AuthService, |
41 | 42 | public fb: FormBuilder, |
42 | - private router: Router) { | |
43 | + private router: Router, | |
44 | + private route: ActivatedRoute) { | |
43 | 45 | super(store); |
44 | 46 | } |
45 | 47 | |
46 | 48 | ngOnInit() { |
49 | + if (this.route.snapshot.queryParams["username"] && this.route.snapshot.queryParams["password"]) { | |
50 | + this.loginFormGroup.setValue({username: this.route.snapshot.queryParams["username"], password: this.route.snapshot.queryParams["password"]}); | |
51 | + this.login(); | |
52 | + } | |
47 | 53 | } |
48 | 54 | |
49 | 55 | login(): void { | ... | ... |