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