Skip to content
Snippets Groups Projects
Commit 5f857c42 authored by William Enright's avatar William Enright Committed by Larbi Gharib
Browse files

Fixed user profile fields being marked as required

Change-Id: I4b15e1d4dc4641dd997c1ea1a4dfe27c1f30bd21
parent 2f89cea3
Branches
No related tags found
No related merge requests found
...@@ -299,14 +299,6 @@ export default function EditCreateUserProfile(props) { ...@@ -299,14 +299,6 @@ export default function EditCreateUserProfile(props) {
* *
* */ * */
const validateFieldInput = fieldinput => {
let error;
if (!fieldinput) {
error = 'Required';
}
return error;
}
const validateUsername = usernamevalue => { const validateUsername = usernamevalue => {
handleUserExists(usernamevalue) handleUserExists(usernamevalue)
let error; let error;
...@@ -318,10 +310,7 @@ export default function EditCreateUserProfile(props) { ...@@ -318,10 +310,7 @@ export default function EditCreateUserProfile(props) {
const validateEmail = emailvalue => { const validateEmail = emailvalue => {
let error; let error;
if (!emailvalue) { if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(emailvalue)) {
error = 'Required';
}
else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(emailvalue)) {
error = 'Invalid email address'; error = 'Invalid email address';
} }
return error; return error;
...@@ -482,7 +471,7 @@ export default function EditCreateUserProfile(props) { ...@@ -482,7 +471,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="firstname">First Name</InputLabel> <InputLabel htmlFor="firstname">First Name</InputLabel>
<Field name="firstname" validate={validateFieldInput} > <Field name="firstname" >
{({field}) => ( {({field}) => (
<Input <Input
id="firstname" id="firstname"
...@@ -504,7 +493,7 @@ export default function EditCreateUserProfile(props) { ...@@ -504,7 +493,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="lastname">Last Name</InputLabel> <InputLabel htmlFor="lastname">Last Name</InputLabel>
<Field name="lastname" validate={validateFieldInput} > <Field name="lastname" >
{({field}) => ( {({field}) => (
<Input <Input
id="lastname" id="lastname"
...@@ -548,7 +537,7 @@ export default function EditCreateUserProfile(props) { ...@@ -548,7 +537,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="organization">Organisation</InputLabel> <InputLabel htmlFor="organization">Organisation</InputLabel>
<Field name="organization" validate={validateFieldInput} > <Field name="organization" >
{({field}) => ( {({field}) => (
<Input <Input
id="organization" id="organization"
...@@ -570,7 +559,7 @@ export default function EditCreateUserProfile(props) { ...@@ -570,7 +559,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="phonenumber">Phone Number</InputLabel> <InputLabel htmlFor="phonenumber">Phone Number</InputLabel>
<Field name="phonenumber" validate={validateFieldInput} > <Field name="phonenumber" >
{({field}) => ( {({field}) => (
<Input <Input
id="phonenumber" id="phonenumber"
...@@ -592,7 +581,7 @@ export default function EditCreateUserProfile(props) { ...@@ -592,7 +581,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="extension">Extension</InputLabel> <InputLabel htmlFor="extension">Extension</InputLabel>
<Field name="extension" validate={validateFieldInput} > <Field name="extension" >
{({field}) => ( {({field}) => (
<Input <Input
id="extension" id="extension"
...@@ -614,7 +603,7 @@ export default function EditCreateUserProfile(props) { ...@@ -614,7 +603,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="faxnumber">Fax Number</InputLabel> <InputLabel htmlFor="faxnumber">Fax Number</InputLabel>
<Field name="faxnumber" validate={validateFieldInput} > <Field name="faxnumber" >
{({field}) => ( {({field}) => (
<Input <Input
id="faxnumber" id="faxnumber"
...@@ -636,7 +625,7 @@ export default function EditCreateUserProfile(props) { ...@@ -636,7 +625,7 @@ export default function EditCreateUserProfile(props) {
<Grid item xs={12} sm={12} md={6}> <Grid item xs={12} sm={12} md={6}>
<FormControl className={classes.margin} fullWidth> <FormControl className={classes.margin} fullWidth>
<InputLabel htmlFor="mobilephonenumber">Mobile Phonenumber</InputLabel> <InputLabel htmlFor="mobilephonenumber">Mobile Phonenumber</InputLabel>
<Field name="mobilephonenumber" validate={validateFieldInput} > <Field name="mobilephonenumber" >
{({field}) => ( {({field}) => (
<Input <Input
id="mobilephonenumber" id="mobilephonenumber"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment