From 6687fbcde0e00c7f110b19138f4dd881315afdc2 Mon Sep 17 00:00:00 2001 From: YeiserGS Date: Mon, 12 Dec 2022 19:58:18 -0500 Subject: [PATCH 1/4] add icons and login --- modern/src/login/LoginPage.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modern/src/login/LoginPage.js b/modern/src/login/LoginPage.js index e35ca2324b..c4c757413c 100644 --- a/modern/src/login/LoginPage.js +++ b/modern/src/login/LoginPage.js @@ -9,6 +9,8 @@ import LockOpenIcon from '@mui/icons-material/LockOpen'; import { useTheme } from '@mui/material/styles'; import { useDispatch, useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; +import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'; +import MailOutlineIcon from '@mui/icons-material/MailOutline'; import { sessionActions } from '../store'; import { useLocalization, useTranslation } from '../common/components/LocalizationProvider'; import LoginLayout from './LoginLayout'; @@ -49,6 +51,8 @@ const LoginPage = () => { const theme = useTheme(); const t = useTranslation(); + const [showPassword, setShowPassword] = useState(false); + const { languages, language, setLanguage } = useLocalization(); const languageList = Object.entries(languages).map((values) => ({ code: values[0], name: values[1].name })); @@ -57,6 +61,10 @@ const LoginPage = () => { const [email, setEmail] = usePersistedState('loginEmail', ''); const [password, setPassword] = useState(''); + const handleClickShowPassword = () => { + setShowPassword(!showPassword); + }; + 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); @@ -153,6 +161,13 @@ const LoginPage = () => { onChange={(e) => setEmail(e.target.value)} onKeyUp={handleSpecialKey} helperText={failed && 'Invalid username or password'} + InputProps={{ + endAdornment: ( + + + + ), + }} /> { label={t('userPassword')} name="password" value={password} - type="password" + type={showPassword ? 'text' : 'password'} autoComplete="current-password" autoFocus={!!email} onChange={(e) => setPassword(e.target.value)} onKeyUp={handleSpecialKey} + InputProps={{ + endAdornment: ( + + + + ), + }} />