diff --git a/src/components/UserProfile/AddNewUserProfile/UserProfileAdd.jsx b/src/components/UserProfile/AddNewUserProfile/UserProfileAdd.jsx index 47e0500271..84f890c121 100644 --- a/src/components/UserProfile/AddNewUserProfile/UserProfileAdd.jsx +++ b/src/components/UserProfile/AddNewUserProfile/UserProfileAdd.jsx @@ -79,6 +79,8 @@ class AddUserProfile extends Component { showphone: true, weeklySummaryOption: 'Required', createdDate: nextDay, + actualEmail: '', + actualPassword: '', }, formValid: {}, formErrors: { @@ -86,6 +88,8 @@ class AddUserProfile extends Component { lastName: 'Last Name is required', email: 'Email is required', phoneNumber: 'Phone Number is required', + actualEmail: "Actual Email is required", + actualPassword: "Actual Password is required", }, location: '', timeZoneFilter: '', @@ -118,7 +122,7 @@ class AddUserProfile extends Component { render() { - const { firstName, email, lastName, phoneNumber, role, jobTitle } = this.state.userProfile; + const { firstName, email, lastName, phoneNumber, role, actualEmail, actualPassword, jobTitle } = this.state.userProfile; const phoneNumberEntered = this.state.userProfile.phoneNumber === null || this.state.userProfile.phoneNumber.length === 0; @@ -280,6 +284,48 @@ class AddUserProfile extends Component { + {(role === 'Administrator' || role === 'Owner') && ( + <> + + + + + + + + {this.state.formErrors.actualEmail} + + + + + + + + + + + {this.state.formErrors.actualPassword} + + + + + )} @@ -587,6 +633,8 @@ class AddUserProfile extends Component { location, weeklySummaryOption, createdDate, + actualEmail, + actualPassword } = that.state.userProfile; const userData = { @@ -611,6 +659,8 @@ class AddUserProfile extends Component { allowsDuplicateName: allowsDuplicateName, createdDate: createdDate, teamCode: this.state.teamCode, + actualEmail: actualEmail, + actualPassword: actualPassword }; this.setState({ formSubmitted: true }); @@ -717,6 +767,19 @@ class AddUserProfile extends Component { }); } break; + case 'credentials': + this.setState({ + formValid: { + ...that.state.formValid, + email: false, + }, + formErrors: { + ...that.state.formErrors, + actualEmail: 'Actual email or password may be incorrect', + actualPassword: 'Actual email or password may be incorrect', + }, + }); + break; } } toast.error( @@ -981,6 +1044,30 @@ class AddUserProfile extends Component { }, }); break; + case 'actualEmail': + this.setState({ + userProfile: { + ...userProfile, + actualEmail: event.target.value + }, + formErrors: { + ...formErrors, + actualEmail: event.target.value.match(patt) ? '' : 'Actual Email is not valid', + }, + }); + break; + case 'actualPassword': + this.setState({ + userProfile: { + ...userProfile, + actualPassword: event.target.value + }, + formErrors: { + ...formErrors, + actualPassword: event.target.value.length > 0 ? '' : 'Actual Password is required', + }, + }); + break; default: this.setState({ ...userProfile,