This commit is contained in:
parent
ff90692b63
commit
27d7709693
|
|
@ -1,4 +1,3 @@
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import { Brand } from "@/components/ui/brand"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Label } from "@/components/ui/label"
|
||||
|
|
@ -20,8 +19,6 @@ export default async function Login({
|
|||
}: {
|
||||
searchParams: { message: string }
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const cookieStore = cookies()
|
||||
const supabase = createServerClient<Database>(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
|
|
@ -78,7 +75,7 @@ export default async function Login({
|
|||
|
||||
if (!homeWorkspace) {
|
||||
throw new Error(
|
||||
homeWorkspaceError?.message || t('login.errorUnexpected')
|
||||
homeWorkspaceError?.message || "An unexpected error occurred"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +116,7 @@ export default async function Login({
|
|||
const emailMatch = emailWhitelist?.includes(email)
|
||||
if (!domainMatch && !emailMatch) {
|
||||
return redirect(
|
||||
`/login?message=${t('login.emailNotAllowed', { email })}`
|
||||
`/login?message=Email ${email} is not allowed to sign up.`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -141,10 +138,10 @@ export default async function Login({
|
|||
return redirect(`/login?message=${error.message}`)
|
||||
}
|
||||
|
||||
return redirect("/setup")
|
||||
|
||||
// USE IF YOU WANT TO SEND EMAIL VERIFICATION, ALSO CHANGE TOML FILE
|
||||
// return redirect("/login?message=Check email to continue sign in process")
|
||||
|
||||
return redirect("/setup")
|
||||
}
|
||||
|
||||
const handleResetPassword = async (formData: FormData) => {
|
||||
|
|
@ -163,7 +160,7 @@ export default async function Login({
|
|||
return redirect(`/login?message=${error.message}`)
|
||||
}
|
||||
|
||||
return redirect("/login?message=" + t('login.passwordResetMessage'))
|
||||
return redirect("/login?message=Check email to reset password")
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -175,43 +172,43 @@ export default async function Login({
|
|||
<Brand />
|
||||
|
||||
<Label className="text-md mt-4" htmlFor="email">
|
||||
{t('login.email')}
|
||||
Email
|
||||
</Label>
|
||||
<Input
|
||||
className="mb-3 rounded-md border bg-inherit px-4 py-2"
|
||||
name="email"
|
||||
placeholder={t('login.emailPlaceholder')}
|
||||
placeholder="you@example.com"
|
||||
required
|
||||
/>
|
||||
|
||||
<Label className="text-md" htmlFor="password">
|
||||
{t('login.password')}
|
||||
Password
|
||||
</Label>
|
||||
<Input
|
||||
className="mb-6 rounded-md border bg-inherit px-4 py-2"
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder={t('login.passwordPlaceholder')}
|
||||
placeholder="••••••••"
|
||||
/>
|
||||
|
||||
<SubmitButton className="mb-2 rounded-md bg-blue-700 px-4 py-2 text-white">
|
||||
{t('login.loginButton')}
|
||||
Login
|
||||
</SubmitButton>
|
||||
|
||||
<SubmitButton
|
||||
formAction={signUp}
|
||||
className="border-foreground/20 mb-2 rounded-md border px-4 py-2"
|
||||
>
|
||||
{t('login.signUpButton')}
|
||||
Sign Up
|
||||
</SubmitButton>
|
||||
|
||||
<div className="text-muted-foreground mt-1 flex justify-center text-sm">
|
||||
<span className="mr-1">{t('login.forgotPassword')}</span>
|
||||
<span className="mr-1">Forgot your password?</span>
|
||||
<button
|
||||
formAction={handleResetPassword}
|
||||
className="text-primary ml-1 underline hover:opacity-80"
|
||||
>
|
||||
{t('login.reset')}
|
||||
Reset
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue