-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
e0697a6
starting
Jingo88 7fe1614
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 2affcdf
setup first page for new device verification notice
Jingo88 d82758a
pulled latest, fixed conflict
Jingo88 d20b7a5
update designs for first page. rename components and files
Jingo88 64598a0
added second page for new device verification notice
Jingo88 5f41eed
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 f96ef7e
update notice page one with bit radio buttons. routing logic. user email
Jingo88 11396b0
pulled latest. fixed conflicts
Jingo88 954cfe9
updated routing for new device verification notice to show before vauโฆ
Jingo88 f011abb
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 ecdff4b
fix translations. added remind me later link and nav to page 2
Jingo88 4c335a2
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 fa70982
sync the design for mobile and web
Jingo88 86b8e87
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 49dbc18
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 9f4514d
update routes in desktop
Jingo88 4880080
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 5c25444
updated styles for desktop
Jingo88 10a8bae
Merge branch 'main' into PM-8214-new-device-notice-UI
Jingo88 407b5ca
moved new device verification notice guard
Jingo88 83421c4
update types for new device notice page one
Jingo88 ac87737
add null check to page one
Jingo88 7bf186c
types
Jingo88 4b1a2e9
types for page one, page two, service, and guard
Jingo88 6e6228a
types
Jingo88 847911c
update component and guard for null check
Jingo88 e441795
add navigation to two step login btn and account email btn
Jingo88 e95377d
Merge branch 'main' of https://github.com/bitwarden/clients into PM-8โฆ
nick-livefront 78fd445
remove empty file
nick-livefront 37fb0ac
Merge branch 'main' of https://github.com/bitwarden/clients into PM-8โฆ
nick-livefront 54d872a
update fill of icons to support light & dark modes
nick-livefront 659e2a7
add question mark to email access verification copy
nick-livefront 84fb842
remove unused map
nick-livefront e3c74cd
use links for navigation elements
nick-livefront 072c58f
remove clip path from exclamation svg
nick-livefront 2ac259d
inline email message into markup
nick-livefront File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./new-device-verification-notice.guard"; | ||
51 changes: 51 additions & 0 deletions
51
libs/angular/src/vault/guards/new-device-verification-notice.guard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
|
||
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"; | ||
|
||
import { NewDeviceVerificationNoticeService } from "../../../../vault/src/services/new-device-verification-notice.service"; | ||
|
||
export const NewDeviceVerificationNoticeGuard: CanActivateFn = async ( | ||
route: ActivatedRouteSnapshot, | ||
) => { | ||
const router = inject(Router); | ||
const configService = inject(ConfigService); | ||
const newDeviceVerificationNoticeService = inject(NewDeviceVerificationNoticeService); | ||
const accountService = inject(AccountService); | ||
|
||
if (route.queryParams["fromNewDeviceVerification"]) { | ||
return true; | ||
} | ||
|
||
const tempNoticeFlag = await configService.getFeatureFlag( | ||
FeatureFlag.NewDeviceVerificationTemporaryDismiss, | ||
); | ||
const permNoticeFlag = await configService.getFeatureFlag( | ||
FeatureFlag.NewDeviceVerificationPermanentDismiss, | ||
); | ||
|
||
const currentAcct$: Observable<Account | null> = accountService.activeAccount$.pipe( | ||
map((acct) => acct), | ||
); | ||
const currentAcct = await firstValueFrom(currentAcct$); | ||
|
||
if (!currentAcct) { | ||
return router.createUrlTree(["/login"]); | ||
} | ||
|
||
const userItems$ = newDeviceVerificationNoticeService.noticeState$(currentAcct.id); | ||
const userItems = await firstValueFrom(userItems$); | ||
|
||
if ( | ||
userItems?.last_dismissal == null && | ||
(userItems?.permanent_dismissal == null || !userItems?.permanent_dismissal) && | ||
(tempNoticeFlag || permNoticeFlag) | ||
) { | ||
return router.createUrlTree(["/new-device-notice"]); | ||
} | ||
|
||
return true; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 thatuserItems
can be null so I removed the optional chaining as well.There was a problem hiding this comment.
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.