oidc: fix error message with correct username but bad password

This commit is contained in:
Girish Ramakrishnan
2023-12-29 18:15:33 +01:00
parent e49398eb47
commit 79448e9ff9
+5 -7
View File
@@ -123,18 +123,16 @@ document.getElementById('loginForm').addEventListener('submit', function (event)
return res.json(); // we always return objects
}).then(function (data) {
if (res.status === 401) {
if (data.message === 'Username and password does not match') {
document.getElementById('inputPassword').value = '';
document.getElementById('inputPassword').focus();
document.getElementById('passwordError').classList.remove('hide');
return;
} else if (data.message.indexOf('totpToken') !== -1) {
if (data.message.indexOf('totpToken') !== -1) {
document.getElementById('inputTotpToken').value = '';
document.getElementById('inputTotpToken').focus();
document.getElementById('totpError').classList.remove('hide');
return;
} else {
throw new Error('Something went wrong');
document.getElementById('inputPassword').value = '';
document.getElementById('inputPassword').focus();
document.getElementById('passwordError').classList.remove('hide');
return;
}
} else if (res.status !== 200) {
throw new Error('Something went wrong');