aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
Diffstat (limited to 'modern')
-rw-r--r--modern/src/login/LoginPage.jsx11
-rw-r--r--modern/src/login/RegisterPage.jsx4
2 files changed, 4 insertions, 11 deletions
diff --git a/modern/src/login/LoginPage.jsx b/modern/src/login/LoginPage.jsx
index 62aa4a6b..2dac3846 100644
--- a/modern/src/login/LoginPage.jsx
+++ b/modern/src/login/LoginPage.jsx
@@ -125,12 +125,6 @@ const LoginPage = () => {
}
});
- const handleSpecialKey = (e) => {
- if (e.keyCode === 13 && email && password && (!codeEnabled || code)) {
- handlePasswordLogin(e);
- }
- };
-
const handleOpenIdLogin = () => {
document.location = '/api/session/openid/auth';
};
@@ -170,7 +164,6 @@ const LoginPage = () => {
autoComplete="email"
autoFocus={!email}
onChange={(e) => setEmail(e.target.value)}
- onKeyUp={handleSpecialKey}
helperText={failed && 'Invalid username or password'}
/>
<TextField
@@ -183,7 +176,6 @@ const LoginPage = () => {
autoComplete="current-password"
autoFocus={!!email}
onChange={(e) => setPassword(e.target.value)}
- onKeyUp={handleSpecialKey}
/>
{codeEnabled && (
<TextField
@@ -194,12 +186,11 @@ const LoginPage = () => {
value={code}
type="number"
onChange={(e) => setCode(e.target.value)}
- onKeyUp={handleSpecialKey}
/>
)}
<Button
onClick={handlePasswordLogin}
- onKeyUp={handleSpecialKey}
+ type="submit"
variant="contained"
color="secondary"
disabled={!email || !password || (codeEnabled && !code)}
diff --git a/modern/src/login/RegisterPage.jsx b/modern/src/login/RegisterPage.jsx
index cffed803..4e2a05e1 100644
--- a/modern/src/login/RegisterPage.jsx
+++ b/modern/src/login/RegisterPage.jsx
@@ -56,7 +56,8 @@ const RegisterPage = () => {
}
}, [totpForce, setTotpKey]);
- const handleSubmit = useCatch(async () => {
+ const handleSubmit = useCatch(async (event) => {
+ event.preventDefault();
const response = await fetch('/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -124,6 +125,7 @@ const RegisterPage = () => {
variant="contained"
color="secondary"
onClick={handleSubmit}
+ type="submit"
disabled={!name || !password || !(server.newServer || /(.+)@(.+)\.(.{2,})/.test(email))}
fullWidth
>