diff options
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/login/LoginPage.js | 22 | ||||
-rw-r--r-- | modern/src/resources/l10n/en.json | 1 |
2 files changed, 22 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} diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json index 33140133..9d76814d 100644 --- a/modern/src/resources/l10n/en.json +++ b/modern/src/resources/l10n/en.json @@ -177,6 +177,7 @@ "loginReset": "Reset Password", "loginRegister": "Register", "loginLogin": "Login", + "loginOpenId": "Login with OpenID", "loginFailed": "Incorrect email address or password", "loginCreated": "New user has been registered", "loginResetSuccess": "Check your email", |