diff --git a/components/soumet/koneksyon.js b/components/soumet/koneksyon.js index 7eba4e6..339cf6f 100644 --- a/components/soumet/koneksyon.js +++ b/components/soumet/koneksyon.js @@ -37,6 +37,10 @@ function Koneksyon() { } const handleClick = async () => { + if (!validateEmail(credentials.username) || credentials.password === '') { + return + } + setLoading(true) const response = await signIn('credentials', { redirect: false, @@ -78,6 +82,12 @@ function Koneksyon() { event.preventDefault() } + const handleKeyUp = event => { + if (event.keyCode === 13) { + handleClick() + } + } + return ( @@ -97,6 +107,7 @@ function Koneksyon() { type='email' id='email' onChange={event => handleUpdate({username: event.target.value})} + onKeyUp={handleKeyUp} /> @@ -119,6 +130,7 @@ function Koneksyon() { } onChange={event => handleUpdate({password: event.target.value})} + onKeyUp={handleKeyUp} />