Skip to content

Commit 9ac3e53

Browse files
Merge pull request #31 from auth0-samples/release-6
Release 6: Implement New Auth Screens & Update Dependencies
2 parents 31c8836 + 415a681 commit 9ac3e53

File tree

21 files changed

+2302
-497
lines changed

21 files changed

+2302
-497
lines changed

package-lock.json

Lines changed: 715 additions & 415 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@auth0/auth0-acul-js": "^0.1.0-beta.4",
13+
"@auth0/auth0-acul-js": "^0.1.0-beta.5",
1414
"react": "^18.3.1",
1515
"react-dom": "^18.3.1",
1616
"react-error-boundary": "^4.1.2"

src/App.tsx

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,26 @@ const MfaPhoneChallengeScreen = React.lazy(() => import("./screens/mfa-phone-cha
5050
const MfaRecoveryCodeEnrollmentScreen = React.lazy(() => import("./screens/mfa-recovery-code-enrollment"));
5151
const ResetPasswordMfaPhoneChallengeScreen = React.lazy(() => import("./screens/reset-password-mfa-phone-challenge"));
5252
const PasskeyEnrollmentScreen = React.lazy(() => import("./screens/passkey-enrollment"));
53-
53+
const MfaRecoveryCodeChallengeNewCodeScreen = React.lazy(() => import("./screens/mfa-recovery-code-challenge-new-code"));
54+
// const EmailOTPChallengeScreen = React.lazy(() => import("./screens/email-otp-challenge"));
55+
const LogoutScreen = React.lazy(() => import("./screens/logout"));
56+
const LogoutAbortedScreen = React.lazy(() => import("./screens/logout-aborted"));
57+
const LogoutCompleteScreen = React.lazy(() => import("./screens/logout-complete"));
58+
const EmailVerificationResultScreen = React.lazy(() => import("./screens/email-verification-result"));
59+
const LoginEmailVerificationScreen = React.lazy(() => import("./screens/login-email-verification"));
60+
const MfaWebAuthnErrorScreen = React.lazy(() => import("./screens/mfa-webauthn-error"));
61+
const MfaWebAuthnPlatformEnrollmentScreen = React.lazy(() => import("./screens/mfa-webauthn-platform-enrollment"));
62+
// const MfaWebAuthnNotAvailableErrorScreen = React.lazy(() => import("./screens/mfa-webauthn-not-available-error"))
63+
const MfaWebAuthnRoamingEnrollment = React.lazy(() => import("./screens/mfa-webauthn-roaming-enrollment"))
64+
const MfaWebAuthnRoamingChallengeScreen = React.lazy(() => import("./screens/mfa-webauthn-roaming-challenge"));
65+
const MfaWebAuthnPlatformChallengeScreen = React.lazy(() => import("./screens/mfa-webauthn-platform-challenge"));
66+
const MfaWebAuthnEnrollmentSuccessScreen = React.lazy(() => import("./screens/mfa-webauthn-enrollment-success"));
67+
const MfaWebAuthnChangeKeyNicknameScreen = React.lazy(() => import("./screens/mfa-webauthn-change-key-nickname"));
68+
// const ResetPasswordMfaWebAuthnRoamingChallengeComponent = React.lazy(() => import("./screens/reset-password-mfa-webauthn-roaming-challenge"));
69+
// const ConsentScreen = React.lazy(() => import("./screens/consent"));
70+
// const ConsentScreen = React.lazy(() => import("./screens/consent"));
71+
const ResetPasswordMfaWebAuthnRoamingChallengeComponent = React.lazy(() => import("./screens/reset-password-mfa-webauthn-roaming-challenge"));
72+
const ResetPasswordMfaWebAuthnPlatformChallengeScreen = React.lazy(() => import("./screens/reset-password-mfa-webauthn-platform-challenge"));
5473

5574
const App: React.FC = () => {
5675
const [screen, setScreen] = React.useState("login-id");
@@ -159,6 +178,42 @@ const App: React.FC = () => {
159178
return <ResetPasswordMfaPhoneChallengeScreen />;
160179
case "passkey-enrollment":
161180
return <PasskeyEnrollmentScreen />;
181+
case "mfa-recovery-code-challenge-new-code":
182+
return <MfaRecoveryCodeChallengeNewCodeScreen />;
183+
// case "email-otp-challenge":
184+
// return <EmailOTPChallengeScreen />;
185+
case "logout":
186+
return <LogoutScreen />;
187+
case "logout-aborted":
188+
return <LogoutAbortedScreen />;
189+
case "logout-complete":
190+
return <LogoutCompleteScreen />;
191+
case "email-verification-result":
192+
return <EmailVerificationResultScreen />;
193+
case "login-email-verification":
194+
return <LoginEmailVerificationScreen />;
195+
case "mfa-webauthn-error":
196+
return <MfaWebAuthnErrorScreen />;
197+
case "mfa-webauthn-platform-enrollment":
198+
return <MfaWebAuthnPlatformEnrollmentScreen />;
199+
// case "mfa-webauthn-not-available-error":
200+
// return <MfaWebAuthnNotAvailableErrorScreen />
201+
case "mfa-webauthn-roaming-enrollment":
202+
return <MfaWebAuthnRoamingEnrollment />
203+
case "mfa-webauthn-roaming-challenge":
204+
return <MfaWebAuthnRoamingChallengeScreen />
205+
case "mfa-webauthn-platform-challenge":
206+
return <MfaWebAuthnPlatformChallengeScreen />
207+
case "mfa-webauthn-enrollment-success":
208+
return <MfaWebAuthnEnrollmentSuccessScreen />
209+
case "reset-password-mfa-webauthn-platform-challenge":
210+
return <ResetPasswordMfaWebAuthnPlatformChallengeScreen />;
211+
// case "consent":
212+
// return <ConsentScreen />;
213+
case "mfa-webauthn-change-key-nickname":
214+
return <MfaWebAuthnChangeKeyNicknameScreen />
215+
case "reset-password-mfa-webauthn-roaming-challenge":
216+
return <ResetPasswordMfaWebAuthnRoamingChallengeComponent />;
162217
default:
163218
return <>No screen rendered</>;
164219
}

src/screens/customized-consent/index.tsx

Lines changed: 0 additions & 61 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import React from 'react';
2+
import EmailVerificationResult from '@auth0/auth0-acul-js/email-verification-result';
3+
4+
const EmailVerificationResultScreen: React.FC = () => {
5+
// Instantiate the SDK class for the Email Verification Result screen
6+
const emailVerificationResultManager = new EmailVerificationResult();
7+
const { client, screen, transaction, organization } = emailVerificationResultManager;
8+
9+
// Determine the message and styling based on the verification status
10+
let statusMessage = 'An unexpected error occurred.';
11+
let statusColor = 'text-gray-700'; // Default color
12+
let title = screen.texts?.title ?? 'Email Verification'; // Default title
13+
14+
const verificationStatus = screen.data?.status;
15+
const loginLink = screen.loginLink;
16+
17+
if (verificationStatus === 'success') {
18+
statusMessage = screen.texts?.descriptionSuccess ?? 'Your email has been successfully verified.';
19+
statusColor = 'text-green-600';
20+
title = screen.texts?.titleSuccess ?? 'Verification Successful';
21+
} else if (verificationStatus === 'failure') {
22+
statusMessage = screen.texts?.descriptionFailure ?? 'There was an issue verifying your email. Please try again or contact support.';
23+
statusColor = 'text-red-600';
24+
title = screen.texts?.titleFailure ?? 'Verification Failed';
25+
} else if (verificationStatus === 'already_verified') {
26+
statusMessage = screen.texts?.descriptionAlreadyVerified ?? 'This email address has already been verified.';
27+
statusColor = 'text-blue-600';
28+
title = screen.texts?.titleAlreadyVerified ?? 'Email Already Verified';
29+
}
30+
// Add more status checks as needed based on actual possible values
31+
32+
const handleGoToLogin = (): void => {
33+
if (loginLink) {
34+
window.location.href = loginLink;
35+
}
36+
};
37+
38+
return (
39+
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-100 p-4">
40+
<div className="w-full max-w-md bg-white rounded-lg shadow-md p-8 text-center">
41+
{client.logoUrl && (
42+
<img src={client.logoUrl} alt={client.name ?? 'Application Logo'} className="mx-auto h-16 mb-6" />
43+
)}
44+
<h1 className={`text-2xl font-semibold mb-4 ${statusColor}`}>
45+
{title}
46+
</h1>
47+
48+
<p className={`text-gray-700 mb-6 ${statusColor}`}>
49+
{statusMessage}
50+
</p>
51+
52+
{organization?.name && (
53+
<p className="text-sm text-gray-500 mb-2">
54+
Organization: {organization.displayName || organization.name}
55+
</p>
56+
)}
57+
58+
{transaction.errors && transaction.errors.length > 0 && (
59+
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4 text-left" role="alert">
60+
<strong className="font-bold">Error(s):</strong>
61+
{transaction.errors.map((err, index) => (
62+
<p key={`tx-error-${index}`} className="block sm:inline ml-2">{err.message}</p>
63+
))}
64+
</div>
65+
)}
66+
67+
{loginLink && (
68+
<button
69+
onClick={handleGoToLogin}
70+
className="w-full px-4 py-2 text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 transition duration-150 ease-in-out"
71+
>
72+
{screen.texts?.buttonText ?? 'Proceed to Login'}
73+
</button>
74+
)}
75+
</div>
76+
</div>
77+
);
78+
};
79+
80+
export default EmailVerificationResultScreen;

0 commit comments

Comments
 (0)