Skip to content

Commit

Permalink
Hide loading screen if you don't enter valid credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhakansson committed Apr 4, 2024
1 parent e425534 commit 932b692
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/frontend/pages/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,25 @@ const Login: NextPage = () => {
// Check if the user has entered both fields correctly
if ("" === email) {
setEmailError("Please enter your email");
setLoginProcessing(false);
return;
}

if (!/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(email)) {
setEmailError("Please enter a valid email");
setLoginProcessing(false);
return;
}

if ("" === password) {
setPasswordError("Please enter a password");
setLoginProcessing(false);
return;
}

if (password.length < 7) {
setPasswordError("The password must be 8 characters or longer");
setLoginProcessing(false);
return;
}

Expand Down

0 comments on commit 932b692

Please sign in to comment.