18559: Add basic field validation for profile email
authorStephen Smith <stephen@curii.com>
Thu, 24 Mar 2022 19:05:25 +0000 (15:05 -0400)
committerStephen Smith <stephen@curii.com>
Thu, 24 Mar 2022 19:05:25 +0000 (15:05 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/validators/validators.tsx
src/views/user-profile-panel/user-profile-panel-root.tsx

index 81fed2ccccdb4220822a342a38eb3af10a38a735..b781a3a97f199960297de1691bafd9e86f830ff6 100644 (file)
@@ -31,6 +31,7 @@ export const PROCESS_DESCRIPTION_VALIDATION = [maxLength(255)];
 export const REPOSITORY_NAME_VALIDATION = [require, maxLength(255)];
 
 export const USER_EMAIL_VALIDATION = [require, maxLength(255)];
+export const PROFILE_EMAIL_VALIDATION = [maxLength(255)];
 export const USER_LENGTH_VALIDATION = [maxLength(255)];
 
 export const SSH_KEY_PUBLIC_VALIDATION = [require, isRsaKey, maxLength(1024)];
index 82c20728209d8ef319f95172a566748afeb5e114..4572a35225fb6c0a829aeebcf74d7357f2fbe5d5 100644 (file)
@@ -23,7 +23,7 @@ import {
 import { ArvadosTheme } from 'common/custom-theme';
 import { User } from "models/user";
 import { DataTableDefaultView } from 'components/data-table-default-view/data-table-default-view';
-import { MY_ACCOUNT_VALIDATION } from "validators/validators";
+import { PROFILE_EMAIL_VALIDATION } from "validators/validators";
 import { USER_PROFILE_PANEL_ID } from 'store/user-profile/user-profile-actions';
 import { noop } from 'lodash';
 import { GroupsIcon } from 'components/icon/icon';
@@ -229,6 +229,7 @@ export const UserProfilePanelRoot = withStyles(styles)(
                                         name="prefs.profile.organization_email"
                                         component={TextField as any}
                                         disabled={!this.props.isAdmin && !this.props.isSelf}
+                                        validate={PROFILE_EMAIL_VALIDATION}
                                     />
                                 </Grid>
                                 <Grid item className={this.props.classes.gridItem} sm={6} xs={12}>