diff --git a/src/components/Signin.tsx b/src/components/Signin.tsx index 66674a522..c858ee292 100644 --- a/src/components/Signin.tsx +++ b/src/components/Signin.tsx @@ -22,9 +22,12 @@ const Signin = () => { const router = useRouter(); const email = useRef(''); const password = useRef(''); - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); + const handleSubmit = async (e?: React.FormEvent) => { + if(e){ + e.preventDefault(); + } + if (!email.current || !password.current) { setRequiredError({ emailReq: email.current ? false : true, @@ -33,6 +36,7 @@ const Signin = () => { return; } + const res = await signIn('credentials', { username: email.current, password: password.current, @@ -92,7 +96,12 @@ const Signin = () => { })); password.current = e.target.value; }} - /> + onKeyDown={async (e)=>{ + if(e.key === "Enter"){ + setIsPasswordVisible(false); + handleSubmit(); + }}} + />