feat(auth): restore Google sign-in and AI admin test routes
Google OAuth was implemented locally but never deployed; the login button only renders when AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET are set. Also restores /api/ai/test-* endpoints removed by mistake and wires Google credentials into deploy workflows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,19 @@ import { authenticate } from '@/app/actions/auth';
|
||||
import Link from 'next/link';
|
||||
import { Mail, Lock, ArrowRight, Sparkles } from 'lucide-react';
|
||||
import { useLanguage } from '@/lib/i18n';
|
||||
import { GoogleSignInButton } from '@/components/google-sign-in-button';
|
||||
|
||||
function AuthDivider({ label }: { label: string }) {
|
||||
return (
|
||||
<div className="relative flex items-center py-2">
|
||||
<div className="flex-grow border-t border-[var(--border)]" />
|
||||
<span className="mx-4 text-[10px] uppercase tracking-widest text-[var(--muted-foreground)] font-bold">
|
||||
{label}
|
||||
</span>
|
||||
<div className="flex-grow border-t border-[var(--border)]" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LoginButton() {
|
||||
const { pending } = useFormStatus();
|
||||
@@ -28,7 +41,13 @@ function LoginButton() {
|
||||
);
|
||||
}
|
||||
|
||||
export function LoginForm({ allowRegister = true }: { allowRegister?: boolean }) {
|
||||
export function LoginForm({
|
||||
allowRegister = true,
|
||||
googleAuthEnabled = false,
|
||||
}: {
|
||||
allowRegister?: boolean;
|
||||
googleAuthEnabled?: boolean;
|
||||
}) {
|
||||
const [errorMessage, dispatch] = useActionState(authenticate, undefined);
|
||||
const { t } = useLanguage();
|
||||
|
||||
@@ -44,6 +63,13 @@ export function LoginForm({ allowRegister = true }: { allowRegister?: boolean })
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{googleAuthEnabled && (
|
||||
<>
|
||||
<GoogleSignInButton label={t('auth.continueWithGoogle')} />
|
||||
<AuthDivider label={t('auth.orContinueWith')} />
|
||||
</>
|
||||
)}
|
||||
|
||||
<form action={dispatch} className="space-y-4">
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-[10px] uppercase tracking-widest font-bold text-[var(--muted-foreground)] px-4">
|
||||
|
||||
Reference in New Issue
Block a user