From cc123a9e67fd219ae9260784c0533f4612773ba3 Mon Sep 17 00:00:00 2001 From: VoBa Date: Thu, 9 Apr 2020 18:38:08 +0300 Subject: [PATCH] [3.0] Added possibility to login by url params (#2592) * Added possibility to login by url params * Fixes after code review --- .../src/app/modules/login/pages/login/login.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/login/pages/login/login.component.ts b/ui-ngx/src/app/modules/login/pages/login/login.component.ts index 6fe81e44ef..b549f94bcc 100644 --- a/ui-ngx/src/app/modules/login/pages/login/login.component.ts +++ b/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, 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 {