diff options
author | zirops <zirops@gmail.com> | 2021-01-27 15:49:43 +0100 |
---|---|---|
committer | zirops <zirops@gmail.com> | 2021-01-27 15:49:43 +0100 |
commit | f70882e49d3cd6deeec75be967365535db2f93b3 (patch) | |
tree | 02b6f3e2f5b8b15b61380a90f0df1eb431dc72f9 /modern/src/LoginPage.js | |
parent | 12184a5ef570593ab492c1499f2d7a23e3be2569 (diff) | |
download | trackermap-web-f70882e49d3cd6deeec75be967365535db2f93b3.tar.gz trackermap-web-f70882e49d3cd6deeec75be967365535db2f93b3.tar.bz2 trackermap-web-f70882e49d3cd6deeec75be967365535db2f93b3.zip |
user self registration code review 1
Diffstat (limited to 'modern/src/LoginPage.js')
-rw-r--r-- | modern/src/LoginPage.js | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/modern/src/LoginPage.js b/modern/src/LoginPage.js index cbe50fe4..14960f82 100644 --- a/modern/src/LoginPage.js +++ b/modern/src/LoginPage.js @@ -8,7 +8,6 @@ import Paper from '@material-ui/core/Paper'; import { makeStyles } from '@material-ui/core'; import TextField from '@material-ui/core/TextField'; import RegisterDialog from './RegisterDialog'; -import Snackbar from '@material-ui/core/Snackbar'; import { useSelector } from 'react-redux'; import t from './common/localization'; @@ -51,18 +50,12 @@ const LoginPage = () => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [registerDialogShown, setRegisterDialogShown] = useState(false); - const [snackbarOpen, setSnackbarOpen] = useState(false); const classes = useStyles(); const history = useHistory(); - const server = useSelector(state => state.session.server); - - let registrationPref = false; - if (server) { - registrationPref = server['registration'] - } - + const registrationPref = useSelector(state => state.session.server ? state.session.server['registration'] : false); + const handleEmailChange = (event) => { setEmail(event.target.value); } @@ -75,11 +68,8 @@ const LoginPage = () => { setRegisterDialogShown(true); } - const handleRegisterResult = (resultOk) => { + const handleRegisterResult = () => { setRegisterDialogShown(false); - if (resultOk) { - setSnackbarOpen(true); - } } const handleLogin = async (event) => { @@ -137,12 +127,11 @@ const LoginPage = () => { </div> </FormControl> </form> - {registerDialogShown && <RegisterDialog open={registerDialogShown} onResult={handleRegisterResult} />} - <Snackbar - anchorOrigin={{ vertical: 'bottom', horizontal: 'center', }} - open={snackbarOpen} autoHideDuration={6000} - onClose={()=>{setSnackbarOpen(false);}} message={t('loginCreated')} - /> + + {registerDialogShown && + <RegisterDialog showDialog={true} onResult={handleRegisterResult} /> + } + </Paper> </main> ); |