ASC.People: ProfileAction: added simple email validation

This commit is contained in:
Andrey Savihin 2019-09-04 14:57:16 +03:00
parent 8f76138886
commit e3f341c032
2 changed files with 4 additions and 2 deletions

View File

@ -80,10 +80,11 @@ class CreateUserForm extends React.Component {
}
validate() {
const emailRegex = /.+@.+\..+/;
const errors = {
firstName: !this.state.profile.firstName,
lastName: !this.state.profile.lastName,
email: !this.state.profile.email,
email: !emailRegex.test(this.state.profile.email),
password: this.state.profile.passwordType === "temp" && !this.state.profile.password
};
const hasError = errors.firstName || errors.lastName || errors.email || errors.password;

View File

@ -76,10 +76,11 @@ class UpdateUserForm extends React.Component {
}
validate() {
const emailRegex = /.+@.+\..+/;
const errors = {
firstName: !this.state.profile.firstName,
lastName: !this.state.profile.lastName,
email: !this.state.profile.email,
email: !emailRegex.test(this.state.profile.email),
password: this.state.profile.passwordType === "temp" && !this.state.profile.password
};
const hasError = errors.firstName || errors.lastName || errors.email || errors.password;