[3.0] Added possibility to login by url params (#2592)
* Added possibility to login by url params * Fixes after code review
This commit is contained in:
parent
359c442365
commit
cc123a9e67
@ -23,6 +23,7 @@ import { FormBuilder } from '@angular/forms';
|
|||||||
import { HttpErrorResponse } from '@angular/common/http';
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
import { Constants } from '@shared/models/constants';
|
import { Constants } from '@shared/models/constants';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { ActivatedRoute } from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-login',
|
selector: 'tb-login',
|
||||||
@ -39,11 +40,16 @@ export class LoginComponent extends PageComponent implements OnInit {
|
|||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
public fb: FormBuilder,
|
public fb: FormBuilder,
|
||||||
private router: Router) {
|
private router: Router,
|
||||||
|
private route: ActivatedRoute) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
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 {
|
login(): void {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user