1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

Extension: setup EmailEntry state UI

This commit is contained in:
rr-bw
2024-09-12 14:46:42 -07:00
parent 9cb64b59ca
commit e616218de5
5 changed files with 69 additions and 6 deletions

View File

@@ -19,6 +19,18 @@
"createAccount": { "createAccount": {
"message": "Create account" "message": "Create account"
}, },
"newToBitwarden": {
"message": "New to Bitwarden?"
},
"logInWithPasskey": {
"message": "Log in with passkey"
},
"useSingleSignOn": {
"message": "Use single sign-on"
},
"welcomeBack": {
"message": "Welcome back"
},
"setAStrongPassword": { "setAStrongPassword": {
"message": "Set a strong password" "message": "Set a strong password"
}, },

View File

@@ -17,6 +17,7 @@ import {
AnonLayoutWrapperComponent, AnonLayoutWrapperComponent,
AnonLayoutWrapperData, AnonLayoutWrapperData,
LoginComponentV2, LoginComponentV2,
LoginSecondaryContentComponent,
RegistrationFinishComponent, RegistrationFinishComponent,
RegistrationStartComponent, RegistrationStartComponent,
RegistrationStartSecondaryComponent, RegistrationStartSecondaryComponent,
@@ -403,6 +404,7 @@ const routes: Routes = [
}, // TODO-rr-bw: add `satisfies DataProperties & ExtensionAnonLayoutWrapperData }, // TODO-rr-bw: add `satisfies DataProperties & ExtensionAnonLayoutWrapperData
children: [ children: [
{ path: "", component: LoginComponentV2 }, { path: "", component: LoginComponentV2 },
{ path: "", component: LoginSecondaryContentComponent, outlet: "secondary" },
{ path: "", component: EnvironmentSelectorComponent, outlet: "environment-selector" }, { path: "", component: EnvironmentSelectorComponent, outlet: "environment-selector" },
], ],
}, },

View File

@@ -11,6 +11,9 @@ import { RegisterRouteService } from "@bitwarden/auth/common";
template: ` template: `
<div class="tw-text-center"> <div class="tw-text-center">
{{ "newToBitwarden" | i18n }} {{ "newToBitwarden" | i18n }}
<!-- TODO-rr-bw: on Browser ext, this link isn't styled like other clients.
It seems to be using default browser (chrome, etc.) styles.
-->
<a class="tw-font-bold" bitLink [routerLink]="registerRoute$ | async">{{ <a class="tw-font-bold" bitLink [routerLink]="registerRoute$ | async">{{
"createAccount" | i18n "createAccount" | i18n
}}</a> }}</a>

View File

@@ -122,7 +122,53 @@
<!-- Browser Template --> <!-- Browser Template -->
<!----------------------------------------------> <!---------------------------------------------->
<form *ngIf="clientType === ClientType.Browser" [bitSubmit]="submit" [formGroup]="formGroup"> <form *ngIf="clientType === ClientType.Browser" [bitSubmit]="submit" [formGroup]="formGroup">
<main tabindex="-1"></main> <ng-container *ngIf="uiState === LoginUiState.EMAIL_ENTRY">
<!-- Email Address input -->
<bit-form-field class="!tw-mb-4">
<bit-label>{{ "emailAddress" | i18n }}</bit-label>
<input type="email" formControlName="email" bitInput appAutofocus />
</bit-form-field>
<!-- Remember Email input -->
<bit-form-control class="!tw-mb-4">
<input type="checkbox" formControlName="rememberEmail" bitCheckbox />
<bit-label>{{ "rememberEmail" | i18n }}</bit-label>
</bit-form-control>
<div class="tw-grid tw-gap-3">
<!-- Continue button -->
<button type="submit" bitButton block buttonType="primary" (click)="validateEmail()">
{{ "continue" | i18n }}
</button>
<!-- TODO-rr-bw: Figma shows no Login with Passkey option on browser? -->
<!-- Link to Login with Passkey page -->
<!-- <div class="tw-text-center">{{ "or" | i18n }}</div>
<a
bitButton
block
linkType="primary"
routerLink="/login-with-passkey"
(mousedown)="$event.preventDefault()"
>
<i class="bwi bwi-passkey tw-mr-1"></i>
{{ "logInWithPasskey" | i18n }}
</a> -->
<!-- Link to Login with SSO page -->
<a
bitButton
block
buttonType="secondary"
routerLink="/sso"
[queryParams]="{ email: formGroup.value.email }"
(click)="saveEmailSettings()"
>
<i class="bwi bwi-provider tw-mr-1"></i>
{{ "useSingleSignOn" | i18n }}
</a>
</div>
</ng-container>
</form> </form>
<!----------------------------------------------> <!---------------------------------------------->

View File

@@ -224,6 +224,8 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
* @returns A simple `return` statement for each conditional check. * @returns A simple `return` statement for each conditional check.
* If you update this method, do not forget to add a `return` * If you update this method, do not forget to add a `return`
* to each if-condition block where necessary to stop code execution. * to each if-condition block where necessary to stop code execution.
*
* TODO-rr-bw: is using returns a good approach, or should we stick with is/else if/else?
*/ */
private async handleAuthResult(authResult: AuthResult): Promise<void> { private async handleAuthResult(authResult: AuthResult): Promise<void> {
if (this.handleCaptchaRequired(authResult)) { if (this.handleCaptchaRequired(authResult)) {
@@ -512,7 +514,6 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
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 (qParams.org != null) { if (qParams.org != null) {
const route = this.router.createUrlTree(["create-organization"], { const route = this.router.createUrlTree(["create-organization"], {
queryParams: { plan: qParams.org }, queryParams: { plan: qParams.org },
@@ -520,10 +521,9 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
this.loginService.setPreviousUrl(route); this.loginService.setPreviousUrl(route);
} }
/** /* If there is a parameter called 'sponsorshipToken', they are coming
* If there is a parameter called 'sponsorshipToken', they are coming from an email for sponsoring a families organization. from an email for sponsoring a families organization. Therefore set
* Therefore set the prevousUrl to `/setup/families-for-enterprise?token=<paramValue>` the prevousUrl to /setup/families-for-enterprise?token=<paramValue> */
*/
if (qParams.sponsorshipToken != null) { if (qParams.sponsorshipToken != null) {
const route = this.router.createUrlTree(["setup/families-for-enterprise"], { const route = this.router.createUrlTree(["setup/families-for-enterprise"], {
queryParams: { token: qParams.sponsorshipToken }, queryParams: { token: qParams.sponsorshipToken },