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 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"> <div class="tw-mb-6 tw-h-28">
<!-- Master Password input --> <!-- Master Password input -->
<bit-form-field class="!tw-mb-1"> <bit-form-field class="!tw-mb-1">
@ -133,5 +139,5 @@
<p class="tw-mb-1">{{ "loggingInAs" | i18n }} {{ loggedEmail }}</p> <p class="tw-mb-1">{{ "loggingInAs" | i18n }} {{ loggedEmail }}</p>
<a [routerLink]="[]" (click)="toggleValidateEmail(false)">{{ "notYou" | i18n }}</a> <a [routerLink]="[]" (click)="toggleValidateEmail(false)">{{ "notYou" | i18n }}</a>
</div> </div>
</ng-container> </div>
</form> </form>

View File

@ -31,6 +31,7 @@ import {
ButtonModule, ButtonModule,
CheckboxModule, CheckboxModule,
FormFieldModule, FormFieldModule,
IconButtonModule,
ToastService, ToastService,
} from "@bitwarden/components"; } from "@bitwarden/components";
@ -45,6 +46,7 @@ import { LoginService } from "./login.service";
CheckboxModule, CheckboxModule,
CommonModule, CommonModule,
FormFieldModule, FormFieldModule,
IconButtonModule,
JslibModule, JslibModule,
ReactiveFormsModule, ReactiveFormsModule,
RouterModule, RouterModule,
@ -117,12 +119,11 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
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
const { policies, isPolicyAndAutoEnrollEnabled, enforcedPasswordPolicyOptions } = const orgPolicies = await this.loginService.getOrgPolicies();
await this.loginService.getOrgPolicies();
this.policies = policies; this.policies = orgPolicies?.policies;
this.showResetPasswordAutoEnrollWarning = isPolicyAndAutoEnrollEnabled; this.showResetPasswordAutoEnrollWarning = orgPolicies?.isPolicyAndAutoEnrollEnabled;
this.enforcedPasswordPolicyOptions = enforcedPasswordPolicyOptions; this.enforcedPasswordPolicyOptions = orgPolicies?.enforcedPasswordPolicyOptions;
} }
} }