1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 21:20:27 +00:00
Files
browser/libs/auth/src/angular/login/login.component.html
Todd Martin f7934b98c6 fix(login): [PM-11502] Support Remember Email option consistently
* Moved saving of SSO email outside of browser/desktop code

* Clarified comments.

* Tests

* Refactored login component services to manage state

* Fixed input on login component

* Fixed tests

* Linting

* Moved web setting in state into web override

* updated tests

* Fixed typing.

* Fixed type safety issues.

* Added comments and renamed for clarity.

* Removed method parameters that weren't used

* Added clarifying comments

* Added more comments.

* Removed test that is not necessary on base

* Test cleanup

* More comments.

* Linting

* Fixed test.

* Fixed base URL

* Fixed typechecking.

* Type checking

* Moved setting of email state to default service

* Added comments.

* Consolidated SSO URL formatting

* Updated comment

* Fixed reference.

* Fixed missing parameter.

* Initialized service.

* Added comments

* Added initialization of new service

* Made email optional due to CLI.

* Fixed comment on handleSsoClick.

* Added SSO email persistence to v1 component.

* Updated login email service.

* Updated setting of remember me

* Removed unnecessary input checking and rearranged functions

* Fixed name

* Added handling of Remember Email to old component for passkey click

* Updated v1 component to persist the email on Continue click

* Fix merge conflicts.

* Merge conflicts in login component.

* Persisted login email on v1 browser component.

* Merge conflicts

* fix(snap) [PM-17464][PM-17463][PM-15587] Allow Snap to use custom callback protocol

* Removed Snap from custom protocol workaround

* Fixed tests.

* Updated case numbers on test

* Resolved PR feedback.

* PM-11502 - LoginEmailSvcAbstraction - mark methods as abstract to satisfy strict ts.

* Removed test

* Changed to persist on leaving fields instead of button click.

* Fixed type checking.

---------

Co-authored-by: Bernd Schoolmann <mail@quexten.com>
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
2025-04-10 18:58:49 -04:00

113 lines
3.6 KiB
HTML

<!--
# Table of Contents
This file contains a single consolidated template for all visual clients.
# UI States
The template has two UI states, defined by the `LoginUiState` enum:
EMAIL_ENTRY: displays the email input field + continue button
MASTER_PASSWORD_ENTRY: displays the master password input field + login button
-->
<form [bitSubmit]="submit" [formGroup]="formGroup">
<div [ngClass]="{ 'tw-hidden': loginUiState !== LoginUiState.EMAIL_ENTRY }">
<!-- Email Address input -->
<bit-form-field>
<bit-label>{{ "emailAddress" | i18n }}</bit-label>
<input
type="email"
formControlName="email"
bitInput
appAutofocus
(input)="onEmailInput($event)"
(keyup.enter)="continuePressed()"
/>
</bit-form-field>
<!-- Remember Email input -->
<bit-form-control>
<input
type="checkbox"
formControlName="rememberEmail"
(input)="onRememberEmailInput($event)"
bitCheckbox
/>
<bit-label>{{ "rememberEmail" | i18n }}</bit-label>
</bit-form-control>
<div class="tw-grid tw-gap-3">
<!-- Continue button -->
<button type="button" bitButton block buttonType="primary" (click)="continuePressed()">
{{ "continue" | i18n }}
</button>
<div class="tw-text-center">{{ "or" | i18n }}</div>
<!-- Button to Login with Passkey -->
<ng-container *ngIf="isLoginWithPasskeySupported()">
<button
type="button"
bitButton
block
buttonType="secondary"
(click)="handleLoginWithPasskeyClick()"
>
<i class="bwi bwi-passkey tw-mr-1"></i>
{{ "logInWithPasskey" | i18n }}
</button>
</ng-container>
<!-- Button to Login with SSO -->
<button type="button" bitButton block buttonType="secondary" (click)="handleSsoClick()">
<i class="bwi bwi-provider tw-mr-1"></i>
{{ "useSingleSignOn" | i18n }}
</button>
</div>
</div>
<div [ngClass]="{ 'tw-hidden': loginUiState !== LoginUiState.MASTER_PASSWORD_ENTRY }">
<!-- Master Password input -->
<bit-form-field class="!tw-mb-1">
<bit-label>{{ "masterPass" | i18n }}</bit-label>
<input type="password" formControlName="masterPassword" bitInput #masterPasswordInputRef />
<button type="button" bitIconButton bitSuffix bitPasswordInputToggle></button>
</bit-form-field>
<!-- Link to Password Hint page - doesn't use bit-hint so that it doesn't get hidden on input validation errors -->
<a bitLink routerLink="/hint" (click)="goToHint()" class="tw-inline-block tw-mb-4">
{{ "getMasterPasswordHint" | i18n }}
</a>
<div class="tw-grid tw-gap-3">
<!-- Submit button to Login with Master Password -->
<button type="submit" bitButton bitFormButton block buttonType="primary">
{{ "loginWithMasterPassword" | i18n }}
</button>
<!-- Button to Login with Device -->
<ng-container *ngIf="isKnownDevice">
<div class="tw-text-center">{{ "or" | i18n }}</div>
<button
type="button"
bitButton
block
buttonType="secondary"
(click)="startAuthRequestLogin()"
>
<i class="bwi bwi-mobile"></i>
{{ "loginWithDevice" | i18n }}
</button>
</ng-container>
<!-- Back button -->
<ng-container *ngIf="shouldShowBackButton()">
<button type="button" bitButton block buttonType="secondary" (click)="backButtonClicked()">
{{ "back" | i18n }}
</button>
</ng-container>
</div>
</div>
</form>