handle master password input focus

This commit is contained in:
rr-bw 2024-09-09 09:51:06 -07:00
parent 70d15fb4d2
commit 00a29b3795
No known key found for this signature in database
GPG Key ID: 3FA13C3ADEE51D5D
2 changed files with 14 additions and 7 deletions

View File

@ -70,7 +70,13 @@
<!-----------------------------------
UI STATE 2: Master Password Entry
------------------------------------>
<ng-container *ngIf="validatedEmail">
<!--
Why not use <ng-container *ngIf="validatedEmail"> to display this section?
Because we want access to the masterPasswordInput reference in the class file.
- Using a hidden div allows us to access the reference without rendering the div initially.
- Using *ngIf would not allow us to access the reference without rendering the ng-container initially.
-->
<div [ngClass]="{ 'tw-hidden': !validatedEmail }">
<div class="tw-mb-6 tw-h-28">
<!-- Master Password input -->
<bit-form-field class="!tw-mb-1">
@ -133,5 +139,5 @@
<p class="tw-mb-1">{{ "loggingInAs" | i18n }} {{ loggedEmail }}</p>
<a [routerLink]="[]" (click)="toggleValidateEmail(false)">{{ "notYou" | i18n }}</a>
</div>
</ng-container>
</div>
</form>

View File

@ -31,6 +31,7 @@ import {
ButtonModule,
CheckboxModule,
FormFieldModule,
IconButtonModule,
ToastService,
} from "@bitwarden/components";
@ -45,6 +46,7 @@ import { LoginService } from "./login.service";
CheckboxModule,
CommonModule,
FormFieldModule,
IconButtonModule,
JslibModule,
ReactiveFormsModule,
RouterModule,
@ -117,12 +119,11 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
if (this.clientType === ClientType.Web) {
// If there's an existing org invite, use it to get the password policies
const { policies, isPolicyAndAutoEnrollEnabled, enforcedPasswordPolicyOptions } =
await this.loginService.getOrgPolicies();
const orgPolicies = await this.loginService.getOrgPolicies();
this.policies = policies;
this.showResetPasswordAutoEnrollWarning = isPolicyAndAutoEnrollEnabled;
this.enforcedPasswordPolicyOptions = enforcedPasswordPolicyOptions;
this.policies = orgPolicies?.policies;
this.showResetPasswordAutoEnrollWarning = orgPolicies?.isPolicyAndAutoEnrollEnabled;
this.enforcedPasswordPolicyOptions = orgPolicies?.enforcedPasswordPolicyOptions;
}
}