People.Client: ProfileAction: validate trimmed field values
This commit is contained in:
parent
2a0812c8c5
commit
63b839ef3a
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user