Initial commit
This commit is contained in:
27
src/app/login/page.tsx
Normal file
27
src/app/login/page.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import { redirect } from 'next/navigation'
|
||||
import { isAuthenticated } from '@/lib/auth'
|
||||
|
||||
export default async function LoginPage({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
||||
if (await isAuthenticated()) {
|
||||
redirect('/settings')
|
||||
}
|
||||
|
||||
const params = await searchParams
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '100vh' }}>
|
||||
<div className="card" style={{ width: 360 }}>
|
||||
<h2>Login WA Test</h2>
|
||||
<p>Masuk pakai akun hardcoded dulu.</p>
|
||||
{params.error ? <div className="error">{params.error}</div> : null}
|
||||
<form method="POST" action="/api/login">
|
||||
<label>Username</label>
|
||||
<input className="input" type="text" name="username" required />
|
||||
<label>Password</label>
|
||||
<input className="input" type="password" name="password" required />
|
||||
<button className="btn" type="submit" style={{ width: '100%' }}>Masuk</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user