From f70882e49d3cd6deeec75be967365535db2f93b3 Mon Sep 17 00:00:00 2001 From: zirops Date: Wed, 27 Jan 2021 15:49:43 +0100 Subject: user self registration code review 1 --- modern/src/LoginPage.js | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'modern/src/LoginPage.js') 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 = () => { - {registerDialogShown && } - {setSnackbarOpen(false);}} message={t('loginCreated')} - /> + + {registerDialogShown && + + } + ); -- cgit v1.2.3