|
@@ -3,7 +3,7 @@ export const regValidate = values => {
|
|
|
const error = {};
|
|
|
|
|
|
if (!login) {
|
|
|
- error.login = "Required" // - true если ничего не надо возвращать
|
|
|
+ error.login = "*" // - true если ничего не надо возвращать
|
|
|
} else if (login.length > 15) {
|
|
|
error.login = 'Must be 15 characters or less'
|
|
|
} else if (!/^[a-zA-Z0-9]+$/.test(login)) {
|
|
@@ -11,25 +11,25 @@ export const regValidate = values => {
|
|
|
}
|
|
|
|
|
|
if (!password) {
|
|
|
- error.password = "Required"
|
|
|
+ error.password = "*"
|
|
|
}else if(!/^[a-zA-Z0-9]+$/.test(password)) {
|
|
|
error.password = "Invalid password"
|
|
|
}
|
|
|
|
|
|
if (!name) {
|
|
|
- error.name = "Required"
|
|
|
+ error.name = "*"
|
|
|
}else if (!/^[a-zA-Z0-9]+$/.test(name)) {
|
|
|
error.name = "Invalid login"
|
|
|
}
|
|
|
|
|
|
if (!phone) {
|
|
|
- error.phone = "Required"
|
|
|
+ error.phone = "*"
|
|
|
}else if(!/^[0-9-+()]+$/.test(phone)) {
|
|
|
error.phone = "Invalid phone number"
|
|
|
}
|
|
|
|
|
|
if (!email) {
|
|
|
- error.email = "Required"
|
|
|
+ error.email = "*"
|
|
|
} else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.]+\.[A-Z]{2,4}$/i.test(email)) {
|
|
|
error.email = 'Invalid email address'
|
|
|
}
|