-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add email verification warning banner
For users that have not verified their email, show a banner letting them know they need to verify their email to avoid interruption
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
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
31 changes: 31 additions & 0 deletions
31
apps/jetstream/src/app/components/core/UnverifiedEmailAlert.tsx
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,31 @@ | ||
import { Maybe, UserProfileUi } from '@jetstream/types'; | ||
import { Alert } from '@jetstream/ui'; | ||
import { useState } from 'react'; | ||
|
||
interface UnverifiedEmailAlertProps { | ||
userProfile: Maybe<UserProfileUi>; | ||
} | ||
|
||
const LS_KEY = 'unverified_email_dismissed'; | ||
|
||
export function UnverifiedEmailAlert({ userProfile }: UnverifiedEmailAlertProps) { | ||
const [dismissed, setDismissed] = useState(() => localStorage.getItem(LS_KEY) === 'true'); | ||
|
||
if (!userProfile || userProfile.email_verified || dismissed) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Alert | ||
type="warning" | ||
leadingIcon="warning" | ||
allowClose | ||
onClose={() => { | ||
localStorage.setItem(LS_KEY, 'true'); | ||
setDismissed(true); | ||
}} | ||
> | ||
We will soon be enabling two-factor authentication via email for all users. Verify your email address to avoid any interruptions. | ||
</Alert> | ||
); | ||
} |