@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input"
88import { Label } from "@/components/ui/label"
99import Link from "next/link"
1010import { motion , AnimatePresence } from "framer-motion"
11- import { signUp } from "@/lib/features/auth"
11+ import { signInOrSignUpWithEmailOnly } from "@/lib/features/auth"
1212import { getTranslations , getUserLanguage } from "@/lib/config"
1313import { LanguageSwitcher } from "@/components/language-switcher"
1414import {
@@ -17,20 +17,13 @@ import {
1717 ArrowRightIcon ,
1818 BoltIcon ,
1919 CheckCircleIcon ,
20- ShieldCheckIcon ,
21- LockClosedIcon ,
22- EyeIcon ,
23- EyeSlashIcon
20+ ShieldCheckIcon
2421} from "@heroicons/react/24/outline"
2522
2623export default function SignUpPage ( ) {
2724 const router = useRouter ( )
2825 const [ email , setEmail ] = useState ( "" )
29- const [ password , setPassword ] = useState ( "" )
30- const [ confirmPassword , setConfirmPassword ] = useState ( "" )
3126 const [ error , setError ] = useState ( "" )
32- const [ showPassword , setShowPassword ] = useState ( false )
33- const [ showConfirmPassword , setShowConfirmPassword ] = useState ( false )
3427 const [ t , setT ] = useState ( getTranslations ( "en" ) )
3528
3629 useEffect ( ( ) => {
@@ -41,23 +34,12 @@ export default function SignUpPage() {
4134 e . preventDefault ( )
4235 setError ( "" )
4336
44- if ( ! email || ! password ) {
45- setError ( "Email and password are required")
37+ if ( ! email ) {
38+ setError ( t . auth . email + " is required")
4639 return
4740 }
4841
49- if ( password !== confirmPassword ) {
50- setError ( "Passwords do not match" )
51- return
52- }
53-
54- if ( password . length < 6 ) {
55- setError ( "Password must be at least 6 characters" )
56- return
57- }
58-
59- // Name is optional in our new flow, passing undefined
60- const result = await signUp ( email , password )
42+ const result = await signInOrSignUpWithEmailOnly ( email , true )
6143
6244 if ( result . success ) {
6345 router . push ( "/dashboard" )
@@ -203,60 +185,6 @@ export default function SignUpPage() {
203185 />
204186 </ div >
205187 </ div >
206-
207- < div className = "space-y-2" >
208- < Label htmlFor = "password" className = "text-xs font-bold uppercase tracking-widest text-slate-500 ml-1" >
209- { t . auth . password }
210- </ Label >
211- < div className = "relative group" >
212- < div className = "absolute left-4 top-1/2 -translate-y-1/2 flex items-center justify-center" >
213- < LockClosedIcon className = "h-5 w-5 text-slate-500 group-focus-within:text-primary transition-colors" />
214- </ div >
215- < Input
216- id = "password"
217- type = { showPassword ? "text" : "password" }
218- placeholder = "••••••••"
219- value = { password }
220- onChange = { ( e ) => setPassword ( e . target . value ) }
221- className = "pl-12 pr-12 h-14 bg-white/[0.03] border-white/5 hover:border-white/10 focus:border-primary/50 transition-all rounded-2xl text-lg placeholder:text-slate-600 focus:ring-0 focus:bg-white/[0.05]"
222- required
223- />
224- < button
225- type = "button"
226- onClick = { ( ) => setShowPassword ( ! showPassword ) }
227- className = "absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 hover:text-white transition-colors"
228- >
229- { showPassword ? < EyeSlashIcon className = "h-5 w-5" /> : < EyeIcon className = "h-5 w-5" /> }
230- </ button >
231- </ div >
232- </ div >
233-
234- < div className = "space-y-2" >
235- < Label htmlFor = "confirmPassword" className = "text-xs font-bold uppercase tracking-widest text-slate-500 ml-1" >
236- Confirm Password
237- </ Label >
238- < div className = "relative group" >
239- < div className = "absolute left-4 top-1/2 -translate-y-1/2 flex items-center justify-center" >
240- < LockClosedIcon className = "h-5 w-5 text-slate-500 group-focus-within:text-primary transition-colors" />
241- </ div >
242- < Input
243- id = "confirmPassword"
244- type = { showConfirmPassword ? "text" : "password" }
245- placeholder = "••••••••"
246- value = { confirmPassword }
247- onChange = { ( e ) => setConfirmPassword ( e . target . value ) }
248- className = "pl-12 pr-12 h-14 bg-white/[0.03] border-white/5 hover:border-white/10 focus:border-primary/50 transition-all rounded-2xl text-lg placeholder:text-slate-600 focus:ring-0 focus:bg-white/[0.05]"
249- required
250- />
251- < button
252- type = "button"
253- onClick = { ( ) => setShowConfirmPassword ( ! showConfirmPassword ) }
254- className = "absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 hover:text-white transition-colors"
255- >
256- { showConfirmPassword ? < EyeSlashIcon className = "h-5 w-5" /> : < EyeIcon className = "h-5 w-5" /> }
257- </ button >
258- </ div >
259- </ div >
260188 </ div >
261189
262190 < div className = "text-sm text-slate-500 font-medium px-1" >
0 commit comments