People.Client: ProfileAction: validate trimmed field values

This commit is contained in:
Andrey Savihin 2019-11-21 13:53:01 +03:00
parent 2a0812c8c5
commit 63b839ef3a
2 changed files with 6 additions and 6 deletions

View File

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

View File

@ -148,8 +148,8 @@ class UpdateUserForm extends React.Component {
validate() {
const { profile } = this.state;
const errors = {
firstName: !profile.firstName,
lastName: !profile.lastName,
firstName: !profile.firstName.trim(),
lastName: !profile.lastName.trim(),
};
const hasError = errors.firstName || errors.lastName;