109 lines
3.9 KiB
TypeScript
109 lines
3.9 KiB
TypeScript
import React, { useState } from "react";
|
|
import { Link } from "react-router-dom";
|
|
import { Label } from "@/components/ui/label";
|
|
import { Input } from "@/components/ui/input";
|
|
import { Button } from "@/components/ui/button";
|
|
import { ArrowLeft, Mail, Check } from "lucide-react";
|
|
import { useToast } from "@/components/ui/use-toast";
|
|
|
|
const ForgotPassword = () => {
|
|
const [email, setEmail] = useState("");
|
|
const [isLoading, setIsLoading] = useState(false);
|
|
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
const { toast } = useToast();
|
|
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
|
|
if (!email) {
|
|
toast({
|
|
title: "입력 오류",
|
|
description: "이메일을 입력해주세요.",
|
|
variant: "destructive",
|
|
});
|
|
return;
|
|
}
|
|
|
|
setIsLoading(true);
|
|
|
|
// 실제 비밀번호 찾기 로직은 추후 구현
|
|
// 임시로 2초 후 성공으로 처리
|
|
setTimeout(() => {
|
|
setIsLoading(false);
|
|
setIsSubmitted(true);
|
|
toast({
|
|
title: "이메일 전송 완료",
|
|
description: "비밀번호 재설정 링크가 이메일로 전송되었습니다.",
|
|
});
|
|
}, 2000);
|
|
};
|
|
|
|
return (
|
|
<div className="min-h-screen flex flex-col items-center justify-center p-6 bg-neuro-background">
|
|
<div className="w-full max-w-md">
|
|
<div className="text-center mb-8">
|
|
<h1 className="text-3xl font-bold text-neuro-income mb-2">비밀번호 찾기</h1>
|
|
<p className="text-gray-500">젤리의 적자탈출 계정에 등록된 이메일을 입력해주세요</p>
|
|
</div>
|
|
|
|
<div className="neuro-flat p-8 mb-6">
|
|
{!isSubmitted ? (
|
|
<form onSubmit={handleSubmit}>
|
|
<div className="space-y-6">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="email" className="text-base">이메일</Label>
|
|
<div className="relative">
|
|
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
placeholder="your@email.com"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
className="pl-10 neuro-pressed"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<Button
|
|
type="submit"
|
|
className="w-full bg-neuro-income hover:bg-neuro-income/80 text-white py-6 h-auto"
|
|
disabled={isLoading}
|
|
>
|
|
{isLoading ? "처리 중..." : "재설정 링크 전송"}
|
|
</Button>
|
|
</div>
|
|
</form>
|
|
) : (
|
|
<div className="text-center space-y-6">
|
|
<div className="mx-auto w-16 h-16 neuro-flat rounded-full flex items-center justify-center text-neuro-income">
|
|
<Check className="h-8 w-8" />
|
|
</div>
|
|
<div>
|
|
<h3 className="text-xl font-semibold mb-2">이메일이 전송되었습니다</h3>
|
|
<p className="text-gray-500">
|
|
{email}로 비밀번호 재설정 링크를 보냈습니다. 이메일을 확인해주세요.
|
|
</p>
|
|
</div>
|
|
<Button
|
|
className="w-full bg-neuro-income hover:bg-neuro-income/80 text-white py-6 h-auto"
|
|
onClick={() => setIsSubmitted(false)}
|
|
>
|
|
다시 시도하기
|
|
</Button>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<div className="text-center">
|
|
<Link to="/login" className="inline-flex items-center text-neuro-income hover:underline">
|
|
<ArrowLeft className="mr-2 h-4 w-4" /> 로그인으로 돌아가기
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ForgotPassword;
|