aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormikems66 <>2021-01-28 16:35:29 +0100
committermikems66 <>2021-01-28 16:35:29 +0100
commit4b1574d1603c01304e5505facccf0a817e5e5026 (patch)
treee61bb251d94e218a6b24304cd5eb8ac88295c099
parent5256eea09b59f3d2793805e960abdae55555a30a (diff)
downloadtrackermap-web-4b1574d1603c01304e5505facccf0a817e5e5026.tar.gz
trackermap-web-4b1574d1603c01304e5505facccf0a817e5e5026.tar.bz2
trackermap-web-4b1574d1603c01304e5505facccf0a817e5e5026.zip
fix formatting, remove validation
-rw-r--r--modern/src/RegisterDialog.js100
1 files changed, 48 insertions, 52 deletions
diff --git a/modern/src/RegisterDialog.js b/modern/src/RegisterDialog.js
index 6dda25ec..32694ead 100644
--- a/modern/src/RegisterDialog.js
+++ b/modern/src/RegisterDialog.js
@@ -20,15 +20,9 @@ const RegisterDialog = ({ showDialog, onResult }) => {
const handleRegister = async (event) => {
let objErrors = {};
- if (formFields.name.trim() === '') {
- objErrors.name = true;
- }
if (!/(.+)@(.+)\.(.{2,})/.test(formFields.email)) {
objErrors.email = true;
}
- if (formFields.password.trim() === '') {
- objErrors.password = true;
- }
if (Object.keys(objErrors).length !== 0) {
setValidationErrors(objErrors);
return;
@@ -56,52 +50,54 @@ const RegisterDialog = ({ showDialog, onResult }) => {
message={t('loginCreated')} />
);
} else if (showDialog) {
- return <Dialog
- open={true}
- onClose={() => { onResult(false) }}>
- <DialogContent>
- <DialogContentText>{t('loginRegister')}</DialogContentText>
- <TextField
- margin='normal'
- required
- fullWidth
- error={validationErrors.name}
- label={t('sharedName')}
- name='name'
- value={formFields.name || ''}
- autoComplete='name'
- autoFocus
- onChange={handleChange}
- helperText={validationErrors.name && t('sharedRequired')} />
- <TextField
- margin='normal'
- required
- fullWidth
- error={validationErrors.email}
- label={t('userEmail')}
- name='email'
- value={formFields.email || ''}
- autoComplete='email'
- onChange={handleChange}
- helperText={validationErrors.email && t('sharedRequired')} />
- <TextField
- margin='normal'
- required
- fullWidth
- error={validationErrors.password}
- label={t('userPassword')}
- name='password'
- value={formFields.password || ''}
- type='password'
- autoComplete='current-password'
- onChange={handleChange}
- helperText={validationErrors.password && t('sharedRequired')} />
- </DialogContent>
- <DialogActions>
- <Button color="primary" onClick={handleRegister} disabled={!formFields.name || !formFields.email || !formFields.password}>{t('loginRegister')}</Button>
- <Button autoFocus onClick={() => onResult(false)}>{t('sharedCancel')}</Button>
- </DialogActions>
- </Dialog>;
+ return (
+ <Dialog
+ open={true}
+ onClose={() => { onResult(false) }}>
+ <DialogContent>
+ <DialogContentText>{t('loginRegister')}</DialogContentText>
+ <TextField
+ margin='normal'
+ required
+ fullWidth
+ error={validationErrors.name}
+ label={t('sharedName')}
+ name='name'
+ value={formFields.name || ''}
+ autoComplete='name'
+ autoFocus
+ onChange={handleChange}
+ helperText={validationErrors.name && t('sharedRequired')} />
+ <TextField
+ margin='normal'
+ required
+ fullWidth
+ error={validationErrors.email}
+ label={t('userEmail')}
+ name='email'
+ value={formFields.email || ''}
+ autoComplete='email'
+ onChange={handleChange}
+ helperText={validationErrors.email && t('sharedRequired')} />
+ <TextField
+ margin='normal'
+ required
+ fullWidth
+ error={validationErrors.password}
+ label={t('userPassword')}
+ name='password'
+ value={formFields.password || ''}
+ type='password'
+ autoComplete='current-password'
+ onChange={handleChange}
+ helperText={validationErrors.password && t('sharedRequired')} />
+ </DialogContent>
+ <DialogActions>
+ <Button color="primary" onClick={handleRegister} disabled={!formFields.name || !formFields.email || !formFields.password}>{t('loginRegister')}</Button>
+ <Button autoFocus onClick={() => onResult(false)}>{t('sharedCancel')}</Button>
+ </DialogActions>
+ </Dialog>
+ )
} else return null;
};