Skip to content

Commit 1a495ad

Browse files
authored
Merge pull request #1019 from hpcc-systems/yadhap/clear-pw-after-failed-login
Cleaer Password after failed login attempt
2 parents 4ad6d9d + 1afb6a9 commit 1a495ad

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Tombolo/client-reactjs/src/components/login/login.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const Login = () => {
1414
const [azureLoginAttempted, setAzureLoginAttempted] = useState(false);
1515
const [email, setEmail] = useState(null);
1616

17+
const [loginForm] = Form.useForm();
18+
1719
// When the form is submitted, this function is called
1820
const onFinish = async (values) => {
1921
const { email, password } = values;
@@ -45,6 +47,7 @@ const Login = () => {
4547

4648
//handle login failed
4749
if (test?.type === Constants.LOGIN_FAILED) {
50+
loginForm.resetFields();
4851
setLoading(false);
4952
return;
5053
}
@@ -119,7 +122,7 @@ const Login = () => {
119122
{expiredPassword && <ExpiredPassword email={email} />}
120123
{!unverifiedUserLoginAttempt && !expiredPassword && (
121124
<>
122-
<Form onFinish={onFinish} layout="vertical">
125+
<Form onFinish={onFinish} layout="vertical" form={loginForm}>
123126
{loading && (
124127
<div
125128
style={{

Tombolo/client-reactjs/src/redux/actions/Auth.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,13 @@ const loginBasicUserFunc = async (email, password, deviceInfo) => {
108108
},
109109
{ headers: authHeader() }
110110
);
111-
112111
const data = await response.json();
113112

114-
if (response.status === 401) {
115-
if (data.message === 'password-expired') {
116-
return data;
117-
} else if (data.message === 'unverified') {
113+
if (response.status === 401 || response.status === 403) {
114+
if (data.message === 'unverified') {
118115
return data;
119116
} else {
120117
message.error(data.message);
121-
122118
return;
123119
}
124120
} else if (!response.ok) {

0 commit comments

Comments
 (0)