Commit cc123a9e67fd219ae9260784c0533f4612773ba3

Authored by VoBa
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
@@ -23,6 +23,7 @@ import { FormBuilder } from '@angular/forms'; @@ -23,6 +23,7 @@ import { FormBuilder } from '@angular/forms';
23 import { HttpErrorResponse } from '@angular/common/http'; 23 import { HttpErrorResponse } from '@angular/common/http';
24 import { Constants } from '@shared/models/constants'; 24 import { Constants } from '@shared/models/constants';
25 import { Router } from '@angular/router'; 25 import { Router } from '@angular/router';
  26 +import { ActivatedRoute } from "@angular/router";
26 27
27 @Component({ 28 @Component({
28 selector: 'tb-login', 29 selector: 'tb-login',
@@ -39,11 +40,16 @@ export class LoginComponent extends PageComponent implements OnInit { @@ -39,11 +40,16 @@ export class LoginComponent extends PageComponent implements OnInit {
39 constructor(protected store: Store<AppState>, 40 constructor(protected store: Store<AppState>,
40 private authService: AuthService, 41 private authService: AuthService,
41 public fb: FormBuilder, 42 public fb: FormBuilder,
42 - private router: Router) { 43 + private router: Router,
  44 + private route: ActivatedRoute) {
43 super(store); 45 super(store);
44 } 46 }
45 47
46 ngOnInit() { 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 login(): void { 55 login(): void {