diff options
Diffstat (limited to 'modern/src/login')
-rw-r--r-- | modern/src/login/LoginPage.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/modern/src/login/LoginPage.js b/modern/src/login/LoginPage.js index e35ca232..59e64bed 100644 --- a/modern/src/login/LoginPage.js +++ b/modern/src/login/LoginPage.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import moment from 'moment'; import { - useMediaQuery, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link, Snackbar, IconButton, Tooltip, + useMediaQuery, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link, Snackbar, IconButton, Tooltip, LinearProgress, } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import CloseIcon from '@mui/icons-material/Close'; @@ -60,6 +60,8 @@ const LoginPage = () => { const registrationEnabled = useSelector((state) => state.session.server.registration); const languageEnabled = useSelector((state) => !state.session.server.attributes['ui.disableLoginLanguage']); const emailEnabled = useSelector((state) => state.session.server.emailEnabled); + const openIdEnabled = useSelector((state) => state.session.server.openIdEnabled); + const openIdForced = useSelector((state) => state.session.server.openIdEnabled && state.session.server.openIdForce); const [announcementShown, setAnnouncementShown] = useState(false); const announcement = useSelector((state) => state.session.server.announcement); @@ -121,6 +123,10 @@ const LoginPage = () => { } }; + const handleOpenIdLogin = () => { + document.location = '/api/session/openid/auth'; + }; + useEffect(() => nativePostMessage('authentication'), []); useEffect(() => { @@ -129,6 +135,11 @@ const LoginPage = () => { return () => handleLoginTokenListeners.delete(listener); }, []); + if (openIdForced) { + handleOpenIdLogin(); + return (<LinearProgress />); + } + return ( <LoginLayout> <div className={classes.options}> @@ -175,6 +186,15 @@ const LoginPage = () => { > {t('loginLogin')} </Button> + {openIdEnabled && ( + <Button + onClick={() => handleOpenIdLogin()} + variant="contained" + color="secondary" + > + {t('loginOpenId')} + </Button> + )} <div className={classes.extraContainer}> <Button className={classes.registerButton} |