20 lines
633 B
JavaScript
20 lines
633 B
JavaScript
export const validateEmail = (email) => {
|
|
return String(email)
|
|
.toLowerCase()
|
|
.match(
|
|
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
);
|
|
};
|
|
|
|
export const messagesError = (msg) => {
|
|
switch (msg) {
|
|
case 'Invalid credentials':
|
|
return 'Email y/o password incorrectos';
|
|
case 'Email is not registered!':
|
|
return 'No se encontro una cuenta con este email';
|
|
case 'Wrong OTP':
|
|
return 'Código ingresado incorrecto';
|
|
default:
|
|
return msg;
|
|
}
|
|
}; |