[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:
VoBa 2020-04-09 18:38:08 +03:00 committed by GitHub
parent 359c442365
commit cc123a9e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {