-
Notifications
You must be signed in to change notification settings - Fork 0
Feature | Add Login UI MFA Flow #142
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
Open
matiasperrone-exo
wants to merge
1
commit into
feat/mfa---usercontroller-mfa-integration-device-trust-cookie-management-audit-wiring-and-2fa-rate-limiting---cu-86ba2zc6p
Choose a base branch
from
feat/mfa---login-ui-flow
base: feat/mfa---usercontroller-mfa-integration-device-trust-cookie-management-audit-wiring-and-2fa-rate-limiting---cu-86ba2zc6p
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,60 @@ | ||
| import React from "react"; | ||
| import Grid from "@material-ui/core/Grid"; | ||
| import Button from "@material-ui/core/Button"; | ||
| import styles from "../login.module.scss"; | ||
|
|
||
| const EmailErrorActions = ({ | ||
| emitOtpAction, | ||
| createAccountAction, | ||
| onValidateEmail, | ||
| disableInput, | ||
| }) => { | ||
| return ( | ||
| <Grid container spacing={1}> | ||
| <Grid | ||
| container | ||
| item | ||
| spacing={1} | ||
| justifyContent="center" | ||
| alignItems="center" | ||
| > | ||
| <Grid item> | ||
| <Button | ||
| variant="contained" | ||
| onClick={emitOtpAction} | ||
| type="button" | ||
| className={styles.secondary_btn} | ||
| color="primary" | ||
| > | ||
| Email me a one time use code | ||
| </Button> | ||
| </Grid> | ||
| <Grid item> | ||
| <Button | ||
| variant="contained" | ||
| href={createAccountAction} | ||
| type="button" | ||
| target="_self" | ||
| className={styles.secondary_btn} | ||
| color="primary" | ||
| > | ||
| Register and set a password | ||
| </Button> | ||
| </Grid> | ||
| <Grid item> | ||
| <Button | ||
| variant="text" | ||
| onClick={onValidateEmail} | ||
| disabled={disableInput} | ||
| className={styles.secondary_btn} | ||
| color="primary" | ||
| > | ||
| Adjust email above and try again | ||
| </Button> | ||
| </Grid> | ||
| </Grid> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default EmailErrorActions; | ||
This file contains hidden or 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,61 @@ | ||
| import React from "react"; | ||
| import Paper from "@material-ui/core/Paper"; | ||
| import TextField from "@material-ui/core/TextField"; | ||
| import Button from "@material-ui/core/Button"; | ||
| import styles from "../login.module.scss"; | ||
| import HTMLRender from "../../shared/HTMLRender"; | ||
|
|
||
| const EmailInputForm = ({ | ||
| value, | ||
| onValidateEmail, | ||
| onHandleUserNameChange, | ||
| disableInput, | ||
| emailError, | ||
| }) => { | ||
| return ( | ||
| <> | ||
| <Paper | ||
| elevation={0} | ||
| component="form" | ||
| target="_self" | ||
| className={styles.paper_root} | ||
| onSubmit={onValidateEmail} | ||
| > | ||
| <TextField | ||
| id="email" | ||
| name="email" | ||
| value={value} | ||
| autoComplete="email" | ||
| variant="outlined" | ||
| margin="normal" | ||
| required | ||
| fullWidth | ||
| disabled={disableInput} | ||
| label="Email Address" | ||
| autoFocus={true} | ||
| onChange={onHandleUserNameChange} | ||
| error={emailError != ""} | ||
| /> | ||
| {emailError == "" && ( | ||
| <Button | ||
| variant="contained" | ||
| color="primary" | ||
| title="Continue" | ||
| className={styles.apply_button} | ||
| disabled={disableInput} | ||
| onClick={onValidateEmail} | ||
| > | ||
| > | ||
| </Button> | ||
| )} | ||
| </Paper> | ||
| {emailError != "" && ( | ||
| <HTMLRender component="p" className={styles.error_label}> | ||
| {emailError} | ||
| </HTMLRender> | ||
| )} | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default EmailInputForm; |
This file contains hidden or 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,47 @@ | ||
| import React from "react"; | ||
| import Grid from "@material-ui/core/Grid"; | ||
| import Button from "@material-ui/core/Button"; | ||
| import Link from "@material-ui/core/Link"; | ||
| import styles from "../login.module.scss"; | ||
|
|
||
| const ExistingAccountActions = ({ | ||
| emitOtpAction, | ||
| forgotPasswordAction, | ||
| userName, | ||
| disableInput, | ||
| }) => { | ||
| let forgotPasswordActionHref = forgotPasswordAction; | ||
|
|
||
| if (userName) { | ||
| forgotPasswordActionHref = `${forgotPasswordAction}?email=${encodeURIComponent(userName)}`; | ||
| } | ||
|
|
||
| return ( | ||
| <Grid container spacing={1} style={{ marginTop: "30px" }}> | ||
| <Grid item xs={12}> | ||
| <Button | ||
| variant="contained" | ||
| onClick={emitOtpAction} | ||
| type="button" | ||
| disabled={disableInput} | ||
| className={styles.secondary_btn} | ||
| color="primary" | ||
| > | ||
| Sign in by emailing me a single-use code | ||
| </Button> | ||
| </Grid> | ||
| <Grid item xs={12}> | ||
| <Link | ||
| onClick={disableInput ? (e) => e.preventDefault() : undefined} | ||
| href={forgotPasswordActionHref} | ||
| target="_self" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| variant="body2" | ||
| > | ||
| Reset your password | ||
| </Link> | ||
| </Grid> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default ExistingAccountActions; | ||
This file contains hidden or 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,78 @@ | ||
| import React, { useMemo } from "react"; | ||
| import Link from "@material-ui/core/Link"; | ||
| import styles from "../login.module.scss"; | ||
|
|
||
| const HelpLinks = ({ | ||
| userName, | ||
| showEmitOtpAction, | ||
| forgotPasswordAction, | ||
| showForgotPasswordAction, | ||
| showVerifyEmailAction, | ||
| verifyEmailAction, | ||
| showHelpAction, | ||
| helpAction, | ||
| appName, | ||
| emitOtpAction, | ||
| }) => { | ||
| const actions = useMemo(() => { | ||
| let forgotPasswordActionHref = forgotPasswordAction; | ||
| if (userName) { | ||
| const separator = forgotPasswordAction.includes("?") ? "&" : "?"; | ||
| forgotPasswordActionHref = `${forgotPasswordAction}${separator}email=${encodeURIComponent(userName)}`; | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| return [ | ||
| { | ||
| show: showEmitOtpAction, | ||
| href: "#", | ||
| onClick: emitOtpAction, | ||
| label: "Get A Single-use Code emailed to you", | ||
| }, | ||
| { | ||
| show: showForgotPasswordAction, | ||
| href: forgotPasswordActionHref, | ||
| label: "Reset your password", | ||
| }, | ||
| { | ||
| show: showVerifyEmailAction, | ||
| href: verifyEmailAction, | ||
| label: `Verify ${appName}`, | ||
| }, | ||
| { | ||
| show: showHelpAction, | ||
| href: helpAction, | ||
| label: "Having trouble?", | ||
| }, | ||
| ].filter((action) => action.show); | ||
| }, [ | ||
| showEmitOtpAction, | ||
| showForgotPasswordAction, | ||
| showVerifyEmailAction, | ||
| showHelpAction, | ||
| userName, | ||
| forgotPasswordAction, | ||
| verifyEmailAction, | ||
| helpAction, | ||
| appName, | ||
| emitOtpAction, | ||
| ]); | ||
|
|
||
| return ( | ||
| <> | ||
| <hr className={styles.separator} /> | ||
| {actions.map((action, index) => ( | ||
| <Link | ||
| key={index} | ||
| href={action.href} | ||
| onClick={action.onClick} | ||
| variant="body2" | ||
| target="_self" | ||
| > | ||
| {action.label} | ||
| </Link> | ||
| ))} | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default HelpLinks; | ||
This file contains hidden or 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,20 @@ | ||
| import React from "react"; | ||
| import Link from "@material-ui/core/Link"; | ||
| import styles from "../login.module.scss"; | ||
|
|
||
| const OTPHelpLinks = ({ emitOtpAction }) => { | ||
| return ( | ||
| <> | ||
| <hr className={styles.separator} /> | ||
| <p className={styles.otp_p}>Didn't receive it ?</p> | ||
| <p className={styles.otp_p}> | ||
| Check your spam folder or{" "} | ||
| <Link href="#" onClick={emitOtpAction} variant="body2" target="_self"> | ||
| resend email. | ||
| </Link> | ||
| </p> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default OTPHelpLinks; |
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.
Uh oh!
There was an error while loading. Please reload this page.