2026-04-15 23:38:26 +00:00
|
|
|
"use client"
|
|
|
|
|
import { Button } from "@/components/ui/button"
|
|
|
|
|
import { Input } from "@/components/ui/input"
|
|
|
|
|
import {
|
|
|
|
|
InputGroup,
|
|
|
|
|
InputGroupAddon,
|
|
|
|
|
InputGroupInput,
|
|
|
|
|
} from "@/components/ui/input-group"
|
|
|
|
|
import { setCookiesEncrypt } from "@/utils/globals"
|
|
|
|
|
import Image from "next/image"
|
|
|
|
|
import { useRouter } from "next/navigation"
|
|
|
|
|
import { useState } from "react"
|
|
|
|
|
import { useForm, Controller } from "react-hook-form"
|
|
|
|
|
import "./globals.css"
|
|
|
|
|
import { EyeIcon, EyeOffIcon } from "@/components/icons"
|
|
|
|
|
|
|
|
|
|
type FormValues = {
|
|
|
|
|
username: string
|
|
|
|
|
password: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function Page() {
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const [viewPassword, setViewPassword] = useState(false)
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
control,
|
|
|
|
|
handleSubmit,
|
|
|
|
|
formState: { errors, isSubmitting },
|
|
|
|
|
} = useForm<FormValues>({
|
|
|
|
|
defaultValues: {
|
|
|
|
|
username: "",
|
|
|
|
|
password: "",
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const onSubmit = async (data: FormValues) => {
|
|
|
|
|
await new Promise((res) => setTimeout(res, 1000))
|
|
|
|
|
if (data.username == "multipool-admin" && data.password == "P@ssw0rd.1") {
|
|
|
|
|
setCookiesEncrypt("status", "Login", { expires: 1 })
|
|
|
|
|
setCookiesEncrypt("username", "multipool-admin", { expires: 1 })
|
|
|
|
|
router.push("/dashboard/account-management")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2026-04-17 09:26:44 +00:00
|
|
|
<div className="flex min-h-svh flex-row items-center justify-center bg-linear-to-r from-violet-50 to-violet-400 text-black">
|
|
|
|
|
<div className="flex h-fit w-[30vw] flex-col items-center justify-center rounded-2xl border border-white/30 bg-white/30 p-16 shadow-[0_20px_60px_rgba(0,0,0,0.25)] backdrop-blur-xl">
|
|
|
|
|
<h1 className="mb-12 self-start text-left text-4xl font-bold text-black">
|
|
|
|
|
Login
|
2026-04-15 23:38:26 +00:00
|
|
|
</h1>
|
2026-04-17 09:26:44 +00:00
|
|
|
<form onSubmit={handleSubmit(onSubmit)} className="w-full text-black">
|
2026-04-15 23:38:26 +00:00
|
|
|
<div className="space-y-8">
|
|
|
|
|
<div>
|
2026-04-17 09:26:44 +00:00
|
|
|
<p className="text-xs tracking-widest text-gray-800 uppercase">
|
|
|
|
|
Username
|
|
|
|
|
</p>{" "}
|
2026-04-15 23:38:26 +00:00
|
|
|
<Controller
|
|
|
|
|
name="username"
|
|
|
|
|
control={control}
|
|
|
|
|
rules={{ required: "Required" }}
|
|
|
|
|
render={({ field }) => (
|
|
|
|
|
<Input
|
|
|
|
|
{...field}
|
2026-04-17 09:26:44 +00:00
|
|
|
placeholder="Enter your username"
|
|
|
|
|
className="mt-2 h-12 w-full rounded-xl border-none bg-white/80! px-4 text-black placeholder:text-gray-500"
|
2026-04-15 23:38:26 +00:00
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
{errors.username && (
|
|
|
|
|
<p className="mt-1 text-xs text-red-400">
|
|
|
|
|
{errors.username.message}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<Controller
|
|
|
|
|
name="password"
|
|
|
|
|
control={control}
|
|
|
|
|
rules={{
|
|
|
|
|
required: "Required",
|
|
|
|
|
}}
|
|
|
|
|
render={({ field }) => (
|
2026-04-17 09:26:44 +00:00
|
|
|
<InputGroup className="mt-2 h-12 w-full rounded-xl border-none bg-white/80! px-2 backdrop-blur">
|
2026-04-15 23:38:26 +00:00
|
|
|
<InputGroupInput
|
|
|
|
|
{...field}
|
|
|
|
|
id="inline-end-input"
|
|
|
|
|
type={viewPassword ? "text" : "password"}
|
2026-04-17 09:26:44 +00:00
|
|
|
placeholder="Enter password here"
|
|
|
|
|
className="bg-white"
|
2026-04-15 23:38:26 +00:00
|
|
|
/>
|
|
|
|
|
<InputGroupAddon align="inline-end">
|
|
|
|
|
<a
|
|
|
|
|
className="cursor-pointer"
|
|
|
|
|
onClick={() => setViewPassword(!viewPassword)}
|
|
|
|
|
>
|
|
|
|
|
{viewPassword ? <EyeOffIcon /> : <EyeIcon />}
|
|
|
|
|
</a>
|
|
|
|
|
</InputGroupAddon>
|
|
|
|
|
</InputGroup>
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
{errors.password && (
|
|
|
|
|
<p className="mt-1 text-xs text-red-400">
|
|
|
|
|
{errors.password.message}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2026-04-17 09:26:44 +00:00
|
|
|
<p className="cursor-pointer text-sm text-blue-500 hover:underline">
|
|
|
|
|
Forgot password?
|
|
|
|
|
</p>
|
2026-04-15 23:38:26 +00:00
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
type="submit"
|
|
|
|
|
disabled={isSubmitting}
|
2026-04-17 09:26:44 +00:00
|
|
|
className="h-12 w-full rounded-xl bg-linear-to-r from-[#4c1d95] to-[#5b21b6] font-semibold tracking-wide text-white"
|
2026-04-15 23:38:26 +00:00
|
|
|
>
|
|
|
|
|
{isSubmitting ? "Loading..." : "Masuk"}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|