diff --git a/app/login/page.tsx b/app/login/page.tsx new file mode 100644 index 0000000..66c3812 --- /dev/null +++ b/app/login/page.tsx @@ -0,0 +1,103 @@ +"use client" + +import { useState } from "react" +import { useRouter } from "next/navigation" +import Link from "next/link" +import { supabase } from "@/lib/supabase" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" +import { AlertCircle, Loader2 } from "lucide-react" + +export default function LoginPage() { + const router = useRouter() + const [email, setEmail] = useState("") + const [password, setPassword] = useState("") + const [loading, setLoading] = useState(false) + const [error, setError] = useState(null) + + const handleLogin = async (e: React.FormEvent) => { + e.preventDefault() + setLoading(true) + setError(null) + + try { + const { error } = await supabase.auth.signInWithPassword({ + email, + password, + }) + + if (error) { + setError(error.message) + return + } + + router.push("/") + router.refresh() + } catch (err: any) { + setError("Bir hata oluştu. Lütfen tekrar deneyin.") + } finally { + setLoading(false) + } + } + + return ( +
+ + + Giriş Yap + + Hesabınıza erişmek için bilgilerinizi girin + + + +
+
+ + setEmail(e.target.value)} + required + /> +
+
+ + setPassword(e.target.value)} + required + /> +
+ {error && ( +
+ + {error} +
+ )} + +
+
+ +
+ Hesabınız yok mu?{" "} + + Kayıt Ol + +
+ + Ana Sayfaya Dön + +
+
+
+ ) +} diff --git a/app/signup/page.tsx b/app/signup/page.tsx new file mode 100644 index 0000000..40364e6 --- /dev/null +++ b/app/signup/page.tsx @@ -0,0 +1,133 @@ +"use client" + +import { useState } from "react" +import { useRouter } from "next/navigation" +import Link from "next/link" +import { supabase } from "@/lib/supabase" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" +import { AlertCircle, Loader2, CheckCircle2 } from "lucide-react" + +export default function SignUpPage() { + const router = useRouter() + const [email, setEmail] = useState("") + const [password, setPassword] = useState("") + const [loading, setLoading] = useState(false) + const [error, setError] = useState(null) + const [success, setSuccess] = useState(false) + + const handleSignUp = async (e: React.FormEvent) => { + e.preventDefault() + setLoading(true) + setError(null) + + try { + const { data, error } = await supabase.auth.signUp({ + email, + password, + options: { + emailRedirectTo: `${location.origin}/auth/callback`, + }, + }) + + if (error) { + setError(error.message) + return + } + + if (data.user) { + setSuccess(true) + } + } catch (err: any) { + setError("Bir hata oluştu. Lütfen tekrar deneyin.") + } finally { + setLoading(false) + } + } + + if (success) { + return ( +
+ + +
+ +
+ Başarılı! + + Kayıt işleminiz başarıyla tamamlandı. Lütfen e-posta adresinizi kontrol ederek hesabınızı doğrulayın. + +
+ + + +
+
+ ) + } + + return ( +
+ + + Hesap Oluştur + + ParaKasa'ya katılmak için bilgilerinizi girin + + + +
+
+ + setEmail(e.target.value)} + required + /> +
+
+ + setPassword(e.target.value)} + required + minLength={6} + /> +

En az 6 karakter olmalıdır.

+
+ {error && ( +
+ + {error} +
+ )} + +
+
+ +
+ Zaten hesabınız var mı?{" "} + + Giriş Yap + +
+ + Ana Sayfaya Dön + +
+
+
+ ) +}