All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s
- Fix useBrainstormSocket: stable guestId via useRef, remove setState in cleanup - Fix GhostCursor: direct DOM manipulation via refs, no useState re-renders - Fix all SQL embedding queries: add ::vector cast on text columns - Fix embedding truncation to 15000 chars (under 8192 token limit) - Fix NoteEmbedding INSERT: remove non-existent updatedAt column - Fix billing page: show all quota stats in grid instead of single metric - Fix usage meter: accordion expand/collapse, per-feature detail - Fix semantic search: rebuild 103 note embeddings, ::vector cast on vectorSearch - Fix brainstorm expand/manual-idea/create: ::vector cast on embedding SQL
30 lines
749 B
TypeScript
30 lines
749 B
TypeScript
'use server';
|
|
|
|
import { signIn } from '@/auth';
|
|
import { AuthError } from 'next-auth';
|
|
|
|
export async function authenticate(
|
|
prevState: string | undefined,
|
|
formData: FormData,
|
|
) {
|
|
try {
|
|
await signIn('credentials', {
|
|
email: formData.get('email'),
|
|
password: formData.get('password'),
|
|
redirectTo: '/home',
|
|
});
|
|
} catch (error) {
|
|
if (error instanceof AuthError) {
|
|
console.error('AuthError details:', error.type, error.message);
|
|
switch (error.type) {
|
|
case 'CredentialsSignin':
|
|
return 'Invalid credentials.';
|
|
default:
|
|
return `Auth error: ${error.type}`;
|
|
}
|
|
}
|
|
// IMPORTANT: Next.js redirects throw a special error that must be rethrown
|
|
throw error;
|
|
}
|
|
}
|