mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
create a defaultOnInit()
This commit is contained in:
@@ -113,26 +113,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
|
|||||||
await this.webOnInit();
|
await this.webOnInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
let paramEmailIsSet = false;
|
await this.defaultOnInit();
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.clientType === ClientType.Web) {
|
if (this.clientType === ClientType.Web) {
|
||||||
// If there's an existing org invite, use it to get the password policies
|
// 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> {
|
private async webOnInit(): Promise<void> {
|
||||||
this.activatedRoute.queryParams.pipe(first(), takeUntil(this.destroy$)).subscribe((qParams) => {
|
this.activatedRoute.queryParams.pipe(first(), takeUntil(this.destroy$)).subscribe((qParams) => {
|
||||||
// If there is a parameter called 'org', set previousUrl to `/create-organization?org=<paramValue>`
|
// If there is a parameter called 'org', set previousUrl to `/create-organization?org=<paramValue>`
|
||||||
|
|||||||
Reference in New Issue
Block a user