Created
November 16, 2020 13:25
-
-
Save alancasagrande/fad6835758fd5c625e0c43b0daa80d13 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import Login from './Login'; | |
import OneTimePassword from './OneTimePassword'; | |
export default function App({ user, requireMfa }) { | |
// User enabled MFA but did not verify code, show OTP form | |
if (requireMfa) { | |
return <OneTimePassword enabled={true} />; | |
} | |
// User not logged in, show login form | |
if (!user) { | |
return <Login />; | |
} | |
// User is authenticated | |
return ( | |
<div> | |
<p> | |
Hello, {user.username}. <a href="/logout">Logout</a> | |
</p> | |
{user.mfaEnabled ? ( | |
<p>Confratulations, multi factor authentication is enabled.</p> | |
) : ( | |
<OneTimePassword enabled={false} /> | |
)} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment