Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Added new layout and page components for forgot password and signup functionalities, enhancing user experience. - Integrated authentication flow handling for password recovery and account creation, utilizing dynamic metadata. - Updated login form to include links for forgot password and signup, improving navigation between authentication states. - Refactored CSS styles for login components to ensure consistent design across different authentication pages.
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
"use client"
|
|
|
|
import { useSearchParams } from "next/navigation"
|
|
import { Suspense } from "react"
|
|
import { LoginForm } from "@/components/auth/login-form"
|
|
import { useNativeRuntime } from "@/lib/platform"
|
|
import { NativeLogin } from "@/components/mobile/native-login"
|
|
|
|
function LoginContent() {
|
|
const searchParams = useSearchParams()
|
|
const error = searchParams.get("error")
|
|
const returnTo = searchParams.get("returnTo") ?? "/mail/inbox"
|
|
const loginHref = `/api/auth/login?returnTo=${encodeURIComponent(returnTo)}`
|
|
const signupHref = `/signup?returnTo=${encodeURIComponent(returnTo)}`
|
|
const forgotPasswordHref = `/forgot-password?returnTo=${encodeURIComponent(returnTo)}`
|
|
|
|
if (useNativeRuntime()) {
|
|
return <NativeLogin returnTo={returnTo} />
|
|
}
|
|
|
|
return (
|
|
<LoginForm
|
|
loginHref={loginHref}
|
|
signupHref={signupHref}
|
|
forgotPasswordHref={forgotPasswordHref}
|
|
error={error}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default function LoginPage() {
|
|
return (
|
|
<Suspense fallback={null}>
|
|
<LoginContent />
|
|
</Suspense>
|
|
)
|
|
}
|