mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-23 21:31:29 +01:00
create a defaultOnInit()
This commit is contained in:
parent
4f893e0769
commit
e8c4217bec
@ -113,26 +113,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
|
||||
await this.webOnInit();
|
||||
}
|
||||
|
||||
let paramEmailIsSet = false;
|
||||
|
||||
this.activatedRoute.queryParams.pipe(takeUntil(this.destroy$)).subscribe((params) => {
|
||||
if (!params) {
|
||||
return;
|
||||
}
|
||||
|
||||
const qParamsEmail = params.email;
|
||||
|
||||
// If there is an email in the query params, set that email as the form field value
|
||||
if (qParamsEmail?.indexOf("@") > -1) {
|
||||
this.formGroup.controls.email.setValue(qParamsEmail);
|
||||
paramEmailIsSet = true;
|
||||
}
|
||||
});
|
||||
|
||||
// If there is no email in the query params, attempt to load email settings from loginEmailService
|
||||
if (!paramEmailIsSet) {
|
||||
await this.loadEmailSettings();
|
||||
}
|
||||
await this.defaultOnInit();
|
||||
|
||||
if (this.clientType === ClientType.Web) {
|
||||
// If there's an existing org invite, use it to get the password policies
|
||||
@ -362,6 +343,29 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
private async defaultOnInit(): Promise<void> {
|
||||
let paramEmailIsSet = false;
|
||||
|
||||
this.activatedRoute.queryParams.pipe(takeUntil(this.destroy$)).subscribe((params) => {
|
||||
if (!params) {
|
||||
return;
|
||||
}
|
||||
|
||||
const qParamsEmail = params.email;
|
||||
|
||||
// If there is an email in the query params, set that email as the form field value
|
||||
if (qParamsEmail?.indexOf("@") > -1) {
|
||||
this.formGroup.controls.email.setValue(qParamsEmail);
|
||||
paramEmailIsSet = true;
|
||||
}
|
||||
});
|
||||
|
||||
// If there is no email in the query params, attempt to load email settings from loginEmailService
|
||||
if (!paramEmailIsSet) {
|
||||
await this.loadEmailSettings();
|
||||
}
|
||||
}
|
||||
|
||||
private async webOnInit(): Promise<void> {
|
||||
this.activatedRoute.queryParams.pipe(first(), takeUntil(this.destroy$)).subscribe((qParams) => {
|
||||
// If there is a parameter called 'org', set previousUrl to `/create-organization?org=<paramValue>`
|
||||
|
Loading…
Reference in New Issue
Block a user