2025-05-17 15:37:25 +02:00
|
|
|
"use client";
|
|
|
|
|
|
2025-05-17 15:22:03 +02:00
|
|
|
import Image from "next/image"
|
|
|
|
|
import Link from "next/link"
|
2025-05-17 12:35:02 +02:00
|
|
|
|
2025-05-17 15:37:25 +02:00
|
|
|
import {useEffect} from "react";
|
|
|
|
|
import { useRouter } from "next/navigation";
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
2025-05-17 15:22:03 +02:00
|
|
|
export default function LoginPage() {
|
2025-05-17 15:37:25 +02:00
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const init = async () => {
|
|
|
|
|
const response = await axios.get("/api/user/init");
|
|
|
|
|
if (response.data.message === "No users found") {
|
|
|
|
|
router.push("/setup");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
init();
|
|
|
|
|
}, []);
|
|
|
|
|
|
2025-05-17 12:35:02 +02:00
|
|
|
return (
|
2025-05-17 15:22:03 +02:00
|
|
|
<div className="min-h-screen flex flex-col lg:flex-row">
|
|
|
|
|
<div className="flex-1 flex items-center justify-center p-6 lg:p-10">
|
|
|
|
|
<div className="w-full max-w-md space-y-8">
|
|
|
|
|
<div className="text-center">
|
|
|
|
|
<h1 className="text-3xl font-bold">Welcome back</h1>
|
|
|
|
|
<p className="mt-2 text-gray-600">Please login with your account</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form className="mt-8 space-y-6">
|
|
|
|
|
<div className="form-control w-full">
|
|
|
|
|
<label className="label">
|
|
|
|
|
<span className="label-text">Email</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input type="email" placeholder="email@example.com" className="input input-bordered w-full" required />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-control w-full">
|
|
|
|
|
<label className="label">
|
|
|
|
|
<span className="label-text">Password</span>
|
|
|
|
|
</label>
|
|
|
|
|
<input type="password" placeholder="Your password" className="input input-bordered w-full" required />
|
|
|
|
|
<label className="label">
|
|
|
|
|
<span className="label-text-alt"></span>
|
|
|
|
|
<Link href="/forgot-password" className="label-text-alt link link-hover">
|
|
|
|
|
Forgot password?
|
|
|
|
|
</Link>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-control">
|
|
|
|
|
<label className="label cursor-pointer justify-start gap-2">
|
|
|
|
|
<input type="checkbox" className="checkbox checkbox-primary" />
|
|
|
|
|
<span className="label-text">Stay logged in</span>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button className="btn btn-primary w-full">Login</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex-1 bg-base-200 hidden lg:block">
|
|
|
|
|
<div className="h-full w-full relative">
|
|
|
|
|
<Image
|
2025-05-17 15:30:04 +02:00
|
|
|
src="/login_wallpaper.jpg"
|
2025-05-17 15:22:03 +02:00
|
|
|
alt="Login Illustration"
|
|
|
|
|
fill
|
|
|
|
|
className="object-cover"
|
|
|
|
|
priority
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="h-48 bg-base-200 relative lg:hidden">
|
|
|
|
|
<Image
|
2025-05-17 15:30:04 +02:00
|
|
|
src="/login_wallpaper.jpg"
|
2025-05-17 15:22:03 +02:00
|
|
|
alt="Login Illustration"
|
|
|
|
|
fill
|
|
|
|
|
className="object-cover"
|
|
|
|
|
priority
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-05-17 12:35:02 +02:00
|
|
|
</div>
|
2025-05-17 15:22:03 +02:00
|
|
|
)
|
2025-05-17 12:35:02 +02:00
|
|
|
}
|