Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions web/src/app/auth/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use client';

import { useState } from 'react';
import { useState, Suspense } from 'react';
import Link from 'next/link';
import { useRouter, useSearchParams } from 'next/navigation';
import { signIn } from 'next-auth/react';
import Button from '@/components/ui/Button';
import Input from '@/components/ui/Input';
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/Card';

export default function LoginPage() {
function LoginContent() {
const router = useRouter();
const searchParams = useSearchParams();
const callbackUrl = searchParams.get('callbackUrl') || '/dashboard';
Expand Down Expand Up @@ -267,3 +267,11 @@ export default function LoginPage() {
</div>
);
}

export default function LoginPage() {
return (
<Suspense fallback={<div className="min-h-screen flex items-center justify-center">Loading...</div>}>
<LoginContent />
</Suspense>
);
}
23 changes: 4 additions & 19 deletions web/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NextAuthOptions } from 'next-auth';
import { SupabaseAdapter } from '@auth/supabase-adapter';
import GoogleProvider from 'next-auth/providers/google';
import GitHubProvider from 'next-auth/providers/github';
import EmailProvider from 'next-auth/providers/email';
import CredentialsProvider from 'next-auth/providers/credentials';
import { createServerSupabaseClient } from './supabase';
import jwt from 'jsonwebtoken';
Expand Down Expand Up @@ -62,27 +61,14 @@ export const authOptions: NextAuthOptions = {
allowDangerousEmailAccountLinking: true,
}),

// GitHub OAuth
GitHubProvider({
// GitHub OAuth (optional - add GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET to enable)
...(process.env.GITHUB_CLIENT_ID ? [GitHubProvider({
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
allowDangerousEmailAccountLinking: true,
}),

// Magic link email authentication
EmailProvider({
server: {
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT) || 587,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
},
from: process.env.EMAIL_FROM || 'LARUN <noreply@larun.space>',
}),
})] : []),

// Email/Password credentials (optional fallback)
// Email/Password credentials
CredentialsProvider({
name: 'credentials',
credentials: {
Expand Down Expand Up @@ -131,7 +117,6 @@ export const authOptions: NextAuthOptions = {

pages: {
signIn: '/auth/login',
signUp: '/auth/register',
error: '/auth/error',
verifyRequest: '/auth/verify',
},
Expand Down
Loading