|
@@ -0,0 +1,19 @@
|
|
|
+export const authValidate = values => {
|
|
|
+ const { email, password } = values;
|
|
|
+ const error = {};
|
|
|
+
|
|
|
+
|
|
|
+ if(!email) {
|
|
|
+ error.email = "Required"
|
|
|
+ } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.]+\.[A-Z]{2,4}$/i.test(email)) {
|
|
|
+ error.email = 'Invalid email address'
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!password) {
|
|
|
+ error.password = "Required"
|
|
|
+ }else if(!/^[a-zA-Z0-9]+$/.test(password)) {
|
|
|
+ error.password = "Invalid password"
|
|
|
+ }
|
|
|
+
|
|
|
+ return error;
|
|
|
+};
|