Remove multiple components related to multi-factor authentication setup

Removed personal account related multi-factor authentication setup modal and otp-input. Adjusted dependencies, exports, and imports to reflect the deletion. Various adjustments in other areas of the codebase were made to account for these deletions, including moving necessary components and adding the 'input-otp' library in the package.json under 'ui' directory.
This commit is contained in:
giancarlo
2024-03-28 01:30:43 +08:00
parent 500fea4bf8
commit 6048cc4759
21 changed files with 1078 additions and 630 deletions

View File

@@ -128,9 +128,10 @@ function getPatterns() {
handler: async (req: NextRequest, res: NextResponse) => {
const supabase = createMiddlewareClient(req, res);
const { data } = await supabase.auth.getSession();
const isVerifyMfa = req.nextUrl.pathname === pathsConfig.auth.verifyMfa;
// If user is logged in, redirect to home page.
if (data.session) {
if (data.session && !isVerifyMfa) {
return NextResponse.redirect(
new URL(pathsConfig.app.home, req.nextUrl.origin).href,
);
@@ -138,7 +139,7 @@ function getPatterns() {
},
},
{
pattern: new URLPattern({ pathname: '/home/*' }),
pattern: new URLPattern({ pathname: '/home*' }),
handler: async (req: NextRequest, res: NextResponse) => {
const supabase = createMiddlewareClient(req, res);
const { data, error } = await supabase.auth.getSession();
@@ -156,6 +157,10 @@ function getPatterns() {
const requiresMultiFactorAuthentication =
await checkRequiresMultiFactorAuthentication(supabase);
console.log({
requiresMultiFactorAuthentication,
});
// If user requires multi-factor authentication, redirect to MFA page.
if (requiresMultiFactorAuthentication) {
return NextResponse.redirect(

View File

@@ -41,7 +41,7 @@
"edge-csrf": "^1.0.9",
"i18next": "^23.10.1",
"i18next-resources-to-backend": "^1.2.0",
"next": "canary",
"next": "14.2.0-canary.44",
"next-contentlayer": "0.3.4",
"next-sitemap": "^4.2.3",
"next-themes": "^0.2.1",
@@ -61,7 +61,7 @@
"@kit/prettier-config": "^0.1.0",
"@kit/tailwind-config": "^0.1.0",
"@kit/tsconfig": "^0.1.0",
"@next/bundle-analyzer": "canary",
"@next/bundle-analyzer": "14.2.0-canary.44",
"@types/mdx": "^2.0.10",
"@types/node": "^20.11.5",
"@types/react": "^18.2.48",

View File

@@ -10,7 +10,7 @@
"connectedAccounts": "Connected Accounts",
"authenticationTab": "Authentication",
"multiFactorAuth": "Multi-Factor Authentication",
"multiFactorAuthSubheading": "Set up a MFA method to secure your account",
"multiFactorAuthDescription": "Set up Multi-Factor Authentication method to further secure your account",
"connectedAccountsSubheading": "Below are the accounts linked to your profile",
"availableProviders": "Available Providers",
"availableProvidersSubheading": "Click on the providers below to link your profile to the provider",
@@ -66,10 +66,10 @@
"connectWithProvider": "Connect with {{ provider }}",
"connectedWithProvider": "Connected with {{ provider }}",
"setupMfaButtonLabel": "Setup a new Factor",
"multiFactorSetupError": "Sorry, there was an error while setting up your factor. Please try again.",
"multiFactorSetupErrorHeading": "Setup Failed",
"multiFactorSetupErrorDescription": "Sorry, there was an error while setting up your factor. Please try again.",
"multiFactorAuthHeading": "Secure your account with Multi-Factor Authentication",
"multiFactorAuthDescription": "Enable Multi-Factor Authentication to verify your identity for an extra layer of security to your account in case your password is stolen. In addition to entering your password, it requires you confirm your identity via SMS.",
"multiFactorModalHeading": "Use your phone to scan the QR code below. Then enter the code generated.",
"multiFactorModalHeading": "Use your authenticator app to scan the QR code below. Then enter the code generated.",
"factorNameLabel": "A memorable name to identify this factor",
"factorNameHint": "Use an easy-to-remember name to easily identify this factor in the future. Ex. iPhone 14",
"factorNameSubmitLabel": "Set factor name",
@@ -78,6 +78,7 @@
"unenrollFactorSuccess": "Factor successfully unenrolled",
"unenrollFactorError": "Unenrolling factor failed",
"factorsListError": "Error loading factors list",
"factorsListErrorDescription": "Sorry, we couldn't load the factors list. Please try again.",
"factorName": "Factor Name",
"factorType": "Type",
"factorStatus": "Status",
@@ -99,13 +100,16 @@
"loadingFactors": "Loading factors...",
"enableMfaFactor": "Enable Factor",
"disableMfaFactor": "Disable Factor",
"qrCodeError": "Sorry, we weren't able to generate the QR code",
"qrCodeErrorHeading": "QR Code Error",
"qrCodeErrorDescription": "Sorry, we weren't able to generate the QR code",
"multiFactorSetupSuccess": "Factor successfully enrolled",
"submitVerificationCode": "Submit Verification Code",
"mfaEnabledSuccessAlert": "Multi-Factor authentication is enabled",
"verifyingCode": "Verifying code...",
"invalidVerificationCode": "Invalid verification code. Please try again",
"invalidVerificationCodeHeading": "Invalid Verification Code",
"invalidVerificationCodeDescription": "The verification code you entered is invalid. Please try again.",
"unenrollFactorModalHeading": "Unenroll Factor",
"unenrollFactorModalDescription": "You're about to unenroll this factor. You will not be able to use it to login to your account.",
"unenrollFactorModalBody": "You're about to unenroll this factor. You will not be able to use it to login to your account.",
"unenrollFactorModalButtonLabel": "Yes, unenroll factor",
"selectFactor": "Choose a factor to verify your identity",