generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#21] Change form error state from map of key/values to just a list d…
…ue to uneeded complexity/issues
- Loading branch information
1 parent
eccb7a8
commit 102e630
Showing
5 changed files
with
63 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"login": { | ||
"sign_in": "Sign in", | ||
"sign-in": "Sign in", | ||
"email": "Email", | ||
"password": "Password", | ||
"forgot_password": "Forgot?" | ||
"forgot-password": "Forgot?", | ||
"invalid-email": "Email has invalid format", | ||
"invalid-password": "Password should be at least {{passwordMinLength}}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const PASSWORD_MIN_LENGTH = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { PASSWORD_MIN_LENGTH } from '../constants'; | ||
|
||
export const isEmailValid = (email: string) => { | ||
const emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; | ||
|
||
return emailRegEx.test(email); | ||
}; | ||
|
||
export const isPasswordValid = (password: string) => { | ||
const passwordRegEx = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/; | ||
|
||
return passwordRegEx.test(password); | ||
// TODO: Should match backend logic or remove completely | ||
return password.length >= PASSWORD_MIN_LENGTH; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters