Skip to content

Commit

Permalink
fix: added the missing code from the merge conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubentalstra committed Feb 12, 2025
1 parent 1cb1c91 commit 091d4f3
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 30 deletions.
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"passport-jwt": "^4.0.1",
"passport-ldapauth": "^3.0.1",
"passport-local": "^1.0.0",
"passport-simple-webauthn2": "^3.0.5",
"sharp": "^0.32.6",
"tiktoken": "^1.0.15",
"traverse": "^0.6.7",
Expand Down
25 changes: 22 additions & 3 deletions client/src/components/Auth/AuthLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import SocialLoginRender from './SocialLoginRender';
import { ThemeSelector } from '~/components/ui';
import { Banner } from '../Banners';
import Footer from './Footer';
import { useState } from 'react';
import PasskeyAuth from '~/components/Auth/PasskeyAuth';

const ErrorRender = ({ children }: { children: React.ReactNode }) => (
<div className="mt-16 flex justify-center">
Expand Down Expand Up @@ -57,6 +59,12 @@ function AuthLayout({
return null;
};

// Determine the mode from the URL: if the pathname contains "register" then mode is "register", else "login"
const mode = pathname.includes('register') ? 'register' : 'login';

// Local state to toggle between the default form (children) and the passkey view.
const [showPasskey, setShowPasskey] = useState(false);

return (
<div className="relative flex min-h-screen flex-col bg-white dark:bg-gray-900">
<Banner />
Expand Down Expand Up @@ -84,9 +92,20 @@ function AuthLayout({
{header}
</h1>
)}
{children}
{(pathname.includes('login') || pathname.includes('register')) && (
<SocialLoginRender startupConfig={startupConfig} />
{/* Conditionally render the default content or the PasskeyAuth component */}
{showPasskey ? (
<PasskeyAuth mode={mode} onBack={() => setShowPasskey(false)} />
) : (
<>
{children}
{(pathname.includes('login') || pathname.includes('register')) && (
<SocialLoginRender
startupConfig={startupConfig}
mode={mode}
onPasskeyClick={() => setShowPasskey(true)}
/>
)}
</>
)}
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion client/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -861,5 +861,11 @@
"com_ui_yes": "Yes",
"com_ui_zoom": "Zoom",
"com_user_message": "You",
"com_warning_resubmit_unsupported": "Resubmitting the AI message is not supported for this endpoint."
"com_warning_resubmit_unsupported": "Resubmitting the AI message is not supported for this endpoint.",
"com_auth_passkey_login": "Login with Passkey",
"com_auth_passkey_register": "Register with Passkey",
"com_auth_loading": "Loading...",
"com_auth_back_to_register": "Back to registration",
"com_nav_passkeys": "Passkeys",
"com_nav_view_passkeys": "View Passkeys"
}
Loading

0 comments on commit 091d4f3

Please sign in to comment.