Skip to content

Commit 70b22d2

Browse files
committed
Login Page Fix
1 parent d5eee45 commit 70b22d2

File tree

3 files changed

+266
-231
lines changed

3 files changed

+266
-231
lines changed

client/common/Button.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ const StyledButton = styled.button`
6666
color: ${({ kind }) => prop(`Button.${kind}.disabled.foreground`)};
6767
background-color: ${({ kind }) =>
6868
prop(`Button.${kind}.disabled.background`)};
69-
border-color: ${({ kind }) => prop(`Button.${kind}.disabled.border`)};
70-
cursor: not-allowed;
71-
69+
}
7270
svg * {
7371
fill: ${({ kind }) => prop(`Button.${kind}.disabled.foreground`)};
7472
}
@@ -144,7 +142,6 @@ const StyledIconButton = styled.button`
144142
fill: ${({ kind }) => prop(`Button.${kind}.active.foreground`)};
145143
}
146144
}
147-
148145
&:disabled {
149146
color: ${({ kind }) => prop(`Button.${kind}.disabled.foreground`)};
150147
background-color: ${({ kind }) =>

client/modules/User/components/LoginForm.jsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { Form, Field } from 'react-final-form';
44
import { useDispatch } from 'react-redux';
@@ -7,8 +7,23 @@ import { validateLogin } from '../../../utils/reduxFormUtils';
77
import { validateAndLoginUser } from '../actions';
88

99
function LoginForm() {
10+
const [contentPresent, setContentPresent] = useState(false);
1011
const { t } = useTranslation();
1112

13+
useEffect(() => {
14+
const checkEmailElement = () => {
15+
if (
16+
document.getElementById('email') &&
17+
document.getElementById('password')
18+
) {
19+
setContentPresent(true);
20+
} else {
21+
setContentPresent(false);
22+
}
23+
};
24+
checkEmailElement();
25+
}, []);
26+
1227
const dispatch = useDispatch();
1328
function onSubmit(formProps) {
1429
return dispatch(validateAndLoginUser(formProps));
@@ -71,7 +86,10 @@ function LoginForm() {
7186
{submitError && !modifiedSinceLastSubmit && (
7287
<span className="form-error">{submitError}</span>
7388
)}
74-
<Button type="submit" disabled={submitting || pristine}>
89+
<Button
90+
type="submit"
91+
disabled={(submitting || pristine) && !contentPresent}
92+
>
7593
{t('LoginForm.Submit')}
7694
</Button>
7795
</form>

0 commit comments

Comments
 (0)