Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-8214] New Device Verification Notice UI #12360

Merged
merged 37 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e0697a6
starting
Jingo88 Nov 22, 2024
7fe1614
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Nov 22, 2024
2affcdf
setup first page for new device verification notice
Jingo88 Nov 22, 2024
d82758a
pulled latest, fixed conflict
Jingo88 Nov 26, 2024
d20b7a5
update designs for first page. rename components and files
Jingo88 Nov 26, 2024
64598a0
added second page for new device verification notice
Jingo88 Nov 26, 2024
5f41eed
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Nov 27, 2024
f96ef7e
update notice page one with bit radio buttons. routing logic. user email
Jingo88 Nov 27, 2024
11396b0
pulled latest. fixed conflicts
Jingo88 Dec 3, 2024
954cfe9
updated routing for new device verification notice to show before vauโ€ฆ
Jingo88 Dec 3, 2024
f011abb
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Dec 5, 2024
ecdff4b
fix translations. added remind me later link and nav to page 2
Jingo88 Dec 6, 2024
4c335a2
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Dec 6, 2024
fa70982
sync the design for mobile and web
Jingo88 Dec 9, 2024
86b8e87
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Dec 9, 2024
49dbc18
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Dec 9, 2024
9f4514d
update routes in desktop
Jingo88 Dec 10, 2024
4880080
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Dec 10, 2024
5c25444
updated styles for desktop
Jingo88 Dec 11, 2024
10a8bae
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 Dec 11, 2024
407b5ca
moved new device verification notice guard
Jingo88 Dec 11, 2024
83421c4
update types for new device notice page one
Jingo88 Dec 11, 2024
ac87737
add null check to page one
Jingo88 Dec 12, 2024
7bf186c
types
Jingo88 Dec 12, 2024
4b1a2e9
types for page one, page two, service, and guard
Jingo88 Dec 12, 2024
6e6228a
types
Jingo88 Dec 12, 2024
847911c
update component and guard for null check
Jingo88 Dec 12, 2024
e441795
add navigation to two step login btn and account email btn
Jingo88 Dec 12, 2024
e95377d
Merge branch 'main' of https://github.com/bitwarden/clients into PM-8โ€ฆ
nick-livefront Dec 17, 2024
78fd445
remove empty file
nick-livefront Dec 17, 2024
37fb0ac
Merge branch 'main' of https://github.com/bitwarden/clients into PM-8โ€ฆ
nick-livefront Dec 17, 2024
54d872a
update fill of icons to support light & dark modes
nick-livefront Dec 17, 2024
659e2a7
add question mark to email access verification copy
nick-livefront Dec 17, 2024
84fb842
remove unused map
nick-livefront Dec 18, 2024
e3c74cd
use links for navigation elements
nick-livefront Dec 18, 2024
072c58f
remove clip path from exclamation svg
nick-livefront Dec 18, 2024
2ac259d
inline email message into markup
nick-livefront Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4910,6 +4910,42 @@
"beta": {
"message": "Beta"
},
"importantNotice": {
"message": "Important notice"
},
"setupTwoStepLogin": {
"message": "Set up two-step login"
},
"newDeviceVerificationNoticeContentPage1": {
"message": "Bitwarden will send a code to your account email to verify logins from new devices starting in February 2025."
},
"newDeviceVerificationNoticeContentPage2": {
"message": "You can set up two-step login as an alternative way to protect your account or change your email to one you can access."
},
"remindMeLater": {
"message": "Remind me later"
},
"newDeviceVerificationNoticePageOneFormContent": {
"message": "Do you have reliable access to your email, $EMAIL$",
"placeholders": {
"email": {
"content": "$1",
"example": "your_name@email.com"
}
}
},
"newDeviceVerificationNoticePageOneEmailAccessNo": {
"message": "No, I do not"
},
"newDeviceVerificationNoticePageOneEmailAccessYes": {
"message": "Yes, I can reliably access my email"
},
"turnOnTwoStepLogin": {
"message": "Turn on two-step login"
},
"changeAcctEmail": {
"message": "Change account email"
},
"extensionWidth": {
"message": "Extension width"
},
Expand Down
35 changes: 34 additions & 1 deletion apps/browser/src/popup/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
import { extensionRefreshRedirect } from "@bitwarden/angular/utils/extension-refresh-redirect";
import { extensionRefreshSwap } from "@bitwarden/angular/utils/extension-refresh-swap";
import { NewDeviceVerificationNoticeGuard } from "@bitwarden/angular/vault/guards";

Check warning on line 22 in apps/browser/src/popup/app-routing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/popup/app-routing.module.ts#L22

Added line #L22 was not covered by tests
import {
AnonLayoutWrapperComponent,
AnonLayoutWrapperData,
Expand All @@ -43,6 +44,11 @@
TwoFactorTimeoutIcon,
} from "@bitwarden/auth/angular";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import {

Check warning on line 47 in apps/browser/src/popup/app-routing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/popup/app-routing.module.ts#L47

Added line #L47 was not covered by tests
NewDeviceVerificationNoticePageOneComponent,
NewDeviceVerificationNoticePageTwoComponent,
VaultIcons,
} from "@bitwarden/vault";

import { twofactorRefactorSwap } from "../../../../libs/angular/src/utils/two-factor-component-refactor-route-swap";
import { fido2AuthGuard } from "../auth/guards/fido2-auth.guard";
Expand Down Expand Up @@ -711,6 +717,33 @@
canActivate: [authGuard],
data: { elevation: 2 } satisfies RouteDataProperties,
},
{
path: "new-device-notice",
component: ExtensionAnonLayoutWrapperComponent,
canActivate: [],
children: [
{
path: "",
component: NewDeviceVerificationNoticePageOneComponent,
data: {
pageIcon: VaultIcons.ExclamationTriangle,
pageTitle: {
key: "importantNotice",
},
},
},
{
path: "setup",
component: NewDeviceVerificationNoticePageTwoComponent,
data: {
pageIcon: VaultIcons.UserLock,
pageTitle: {
key: "setupTwoStepLogin",
},
},
},
],
},
...extensionRefreshSwap(TabsComponent, TabsV2Component, {
path: "tabs",
data: { elevation: 0 } satisfies RouteDataProperties,
Expand All @@ -730,7 +763,7 @@
},
...extensionRefreshSwap(VaultFilterComponent, VaultV2Component, {
path: "vault",
canActivate: [authGuard],
canActivate: [authGuard, NewDeviceVerificationNoticeGuard],
canDeactivate: [clearVaultStateGuard],
data: { elevation: 0 } satisfies RouteDataProperties,
}),
Expand Down
35 changes: 34 additions & 1 deletion apps/desktop/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
} from "@bitwarden/angular/auth/guards";
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
import { extensionRefreshRedirect } from "@bitwarden/angular/utils/extension-refresh-redirect";
import { NewDeviceVerificationNoticeGuard } from "@bitwarden/angular/vault/guards";

Check warning on line 19 in apps/desktop/src/app/app-routing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/app/app-routing.module.ts#L19

Added line #L19 was not covered by tests
import {
AnonLayoutWrapperComponent,
AnonLayoutWrapperData,
Expand All @@ -40,6 +41,11 @@
TwoFactorTimeoutIcon,
} from "@bitwarden/auth/angular";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import {

Check warning on line 44 in apps/desktop/src/app/app-routing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/app/app-routing.module.ts#L44

Added line #L44 was not covered by tests
NewDeviceVerificationNoticePageOneComponent,
NewDeviceVerificationNoticePageTwoComponent,
VaultIcons,
} from "@bitwarden/vault";

import { twofactorRefactorSwap } from "../../../../libs/angular/src/utils/two-factor-component-refactor-route-swap";
import { AccessibilityCookieComponent } from "../auth/accessibility-cookie.component";
Expand Down Expand Up @@ -116,10 +122,37 @@
} satisfies RouteDataProperties & AnonLayoutWrapperData,
},
{ path: "register", component: RegisterComponent },
{
path: "new-device-notice",
component: AnonLayoutWrapperComponent,
canActivate: [],
children: [
{
path: "",
component: NewDeviceVerificationNoticePageOneComponent,
data: {
pageIcon: VaultIcons.ExclamationTriangle,
pageTitle: {
key: "importantNotice",
},
},
},
{
path: "setup",
component: NewDeviceVerificationNoticePageTwoComponent,
data: {
pageIcon: VaultIcons.UserLock,
pageTitle: {
key: "setupTwoStepLogin",
},
},
},
],
},
{
path: "vault",
component: VaultComponent,
canActivate: [authGuard],
canActivate: [authGuard, NewDeviceVerificationNoticeGuard],
},
{ path: "accessibility-cookie", component: AccessibilityCookieComponent },
{ path: "set-password", component: SetPasswordComponent },
Expand Down
36 changes: 36 additions & 0 deletions apps/desktop/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3394,5 +3394,41 @@
},
"fileSavedToDevice": {
"message": "File saved to device. Manage from your device downloads."
},
"importantNotice": {
"message": "Important notice"
},
"setupTwoStepLogin": {
"message": "Set up two-step login"
},
"newDeviceVerificationNoticeContentPage1": {
"message": "Bitwarden will send a code to your account email to verify logins from new devices starting in February 2025."
},
"newDeviceVerificationNoticeContentPage2": {
"message": "You can set up two-step login as an alternative way to protect your account or change your email to one you can access."
},
"remindMeLater": {
"message": "Remind me later"
},
"newDeviceVerificationNoticePageOneFormContent": {
"message": "Do you have reliable access to your email, $EMAIL$",
"placeholders": {
"email": {
"content": "$1",
"example": "your_name@email.com"
}
}
},
"newDeviceVerificationNoticePageOneEmailAccessNo": {
"message": "No, I do not"
},
"newDeviceVerificationNoticePageOneEmailAccessYes": {
"message": "Yes, I can reliably access my email"
},
"turnOnTwoStepLogin": {
"message": "Turn on two-step login"
},
"changeAcctEmail": {
"message": "Change account email"
}
}
1 change: 1 addition & 0 deletions apps/desktop/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config.content = [
"../../libs/components/src/**/*.{html,ts}",
"../../libs/auth/src/**/*.{html,ts}",
"../../libs/angular/src/**/*.{html,ts}",
"../../libs/vault/src/**/*.{html,ts,mdx}",
];

module.exports = config;
35 changes: 34 additions & 1 deletion apps/web/src/app/oss-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
import { generatorSwap } from "@bitwarden/angular/tools/generator/generator-swap";
import { extensionRefreshSwap } from "@bitwarden/angular/utils/extension-refresh-swap";
import { NewDeviceVerificationNoticeGuard } from "@bitwarden/angular/vault/guards";

Check warning on line 16 in apps/web/src/app/oss-routing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/oss-routing.module.ts#L16

Added line #L16 was not covered by tests
import {
AnonLayoutWrapperComponent,
AnonLayoutWrapperData,
Expand Down Expand Up @@ -40,6 +41,11 @@
LoginDecryptionOptionsComponent,
} from "@bitwarden/auth/angular";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import {

Check warning on line 44 in apps/web/src/app/oss-routing.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/oss-routing.module.ts#L44

Added line #L44 was not covered by tests
NewDeviceVerificationNoticePageOneComponent,
NewDeviceVerificationNoticePageTwoComponent,
VaultIcons,
} from "@bitwarden/vault";

import { twofactorRefactorSwap } from "../../../../libs/angular/src/utils/two-factor-component-refactor-route-swap";
import { flagEnabled, Flags } from "../utils/flags";
Expand Down Expand Up @@ -695,10 +701,37 @@
},
],
},
{
path: "new-device-notice",
component: AnonLayoutWrapperComponent,
canActivate: [],
children: [
{
path: "",
component: NewDeviceVerificationNoticePageOneComponent,
data: {
pageIcon: VaultIcons.ExclamationTriangle,
pageTitle: {
key: "importantNotice",
},
},
},
{
path: "setup",
component: NewDeviceVerificationNoticePageTwoComponent,
data: {
pageIcon: VaultIcons.UserLock,
pageTitle: {
key: "setupTwoStepLogin",
},
},
},
],
},
{
path: "",
component: UserLayoutComponent,
canActivate: [deepLinkGuard(), authGuard],
canActivate: [deepLinkGuard(), authGuard, NewDeviceVerificationNoticeGuard],
children: [
{
path: "vault",
Expand Down
36 changes: 36 additions & 0 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9885,6 +9885,42 @@
"descriptorCode": {
"message": "Descriptor code"
},
"importantNotice": {
"message": "Important notice"
},
"setupTwoStepLogin": {
"message": "Set up two-step login"
},
"newDeviceVerificationNoticeContentPage1": {
"message": "Bitwarden will send a code to your account email to verify logins from new devices starting in February 2025."
},
"newDeviceVerificationNoticeContentPage2": {
"message": "You can set up two-step login as an alternative way to protect your account or change your email to one you can access."
},
"remindMeLater": {
"message": "Remind me later"
},
"newDeviceVerificationNoticePageOneFormContent": {
"message": "Do you have reliable access to your email, $EMAIL$",
"placeholders": {
"email": {
"content": "$1",
"example": "your_name@email.com"
}
}
},
"newDeviceVerificationNoticePageOneEmailAccessNo": {
"message": "No, I do not"
},
"newDeviceVerificationNoticePageOneEmailAccessYes": {
"message": "Yes, I can reliably access my email"
},
"turnOnTwoStepLogin": {
"message": "Turn on two-step login"
},
"changeAcctEmail": {
"message": "Change account email"
},
"removeMembers": {
"message": "Remove members"
},
Expand Down
2 changes: 2 additions & 0 deletions libs/angular/src/services/jslib-services.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
IndividualVaultExportServiceAbstraction,
} from "@bitwarden/vault-export-core";

import { NewDeviceVerificationNoticeService } from "../../../vault/src/services/new-device-verification-notice.service";

Check warning on line 301 in libs/angular/src/services/jslib-services.module.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/services/jslib-services.module.ts#L301

Added line #L301 was not covered by tests
import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction } from "../platform/abstractions/form-validation-errors.service";
import { ViewCacheService } from "../platform/abstractions/view-cache.service";
import { FormValidationErrorsService } from "../platform/services/form-validation-errors.service";
Expand Down Expand Up @@ -1401,6 +1402,7 @@
useClass: DefaultLoginDecryptionOptionsService,
deps: [MessagingServiceAbstraction],
}),
safeProvider(NewDeviceVerificationNoticeService),
safeProvider({
provide: UserAsymmetricKeysRegenerationApiService,
useClass: DefaultUserAsymmetricKeysRegenerationApiService,
Expand Down
1 change: 1 addition & 0 deletions libs/angular/src/vault/guards/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./new-device-verification-notice.guard";

Check warning on line 1 in libs/angular/src/vault/guards/index.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/index.ts#L1

Added line #L1 was not covered by tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { inject } from "@angular/core";
import { ActivatedRouteSnapshot, CanActivateFn, Router } from "@angular/router";
import { Observable, firstValueFrom, map } from "rxjs";

Check warning on line 3 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L1-L3

Added lines #L1 - L3 were not covered by tests

import { Account, AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";

Check warning on line 7 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L5-L7

Added lines #L5 - L7 were not covered by tests

import { NewDeviceVerificationNoticeService } from "../../../../vault/src/services/new-device-verification-notice.service";

Check warning on line 9 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L9

Added line #L9 was not covered by tests

export const NewDeviceVerificationNoticeGuard: CanActivateFn = async (

Check warning on line 11 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L11

Added line #L11 was not covered by tests
route: ActivatedRouteSnapshot,
) => {
const router = inject(Router);
const configService = inject(ConfigService);
const newDeviceVerificationNoticeService = inject(NewDeviceVerificationNoticeService);
const accountService = inject(AccountService);

Check warning on line 17 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L13-L17

Added lines #L13 - L17 were not covered by tests

if (route.queryParams["fromNewDeviceVerification"]) {
return true;

Check warning on line 20 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L20

Added line #L20 was not covered by tests
}

const tempNoticeFlag = await configService.getFeatureFlag(

Check warning on line 23 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L23

Added line #L23 was not covered by tests
FeatureFlag.NewDeviceVerificationTemporaryDismiss,
);
const permNoticeFlag = await configService.getFeatureFlag(

Check warning on line 26 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L26

Added line #L26 was not covered by tests
FeatureFlag.NewDeviceVerificationPermanentDismiss,
);

const currentAcct$: Observable<Account | null> = accountService.activeAccount$.pipe(
map((acct) => acct),

Check warning on line 31 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L30-L31

Added lines #L30 - L31 were not covered by tests
);
const currentAcct = await firstValueFrom(currentAcct$);

Check warning on line 33 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L33

Added line #L33 was not covered by tests

if (!currentAcct) {
return router.createUrlTree(["/login"]);

Check warning on line 36 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L36

Added line #L36 was not covered by tests
}

const userItems$ = newDeviceVerificationNoticeService.noticeState$(currentAcct.id);
const userItems = await firstValueFrom(userItems$);

Check warning on line 40 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L39-L40

Added lines #L39 - L40 were not covered by tests

if (
userItems?.last_dismissal == null &&
(userItems?.permanent_dismissal == null || !userItems?.permanent_dismissal) &&
(tempNoticeFlag || permNoticeFlag)
) {
Comment on lines +42 to +46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โ›๏ธ (non-blocking) this logic could be cleaned up by deconstructing userItems. The types don't suggest that userItems can be null so I removed the optional chaining as well.

Suggested change
if (
userItems?.last_dismissal == null &&
(userItems?.permanent_dismissal == null || !userItems?.permanent_dismissal) &&
(tempNoticeFlag || permNoticeFlag)
) {
const { last_dismissal, permanent_dismissal } = userItems;
if (last_dismissal == null && !permanent_dismissal && (tempNoticeFlag || permNoticeFlag)) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this code altered in my following work so this is does not need to be changed here.

return router.createUrlTree(["/new-device-notice"]);

Check warning on line 47 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L47

Added line #L47 was not covered by tests
}

return true;

Check warning on line 50 in libs/angular/src/vault/guards/new-device-verification-notice.guard.ts

View check run for this annotation

Codecov / codecov/patch

libs/angular/src/vault/guards/new-device-verification-notice.guard.ts#L50

Added line #L50 was not covered by tests
};
Loading
Loading