improved error message display on login papge

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-10-18 21:04:00 +02:00
parent 951c65c121
commit 5458e6d015
16 changed files with 109 additions and 79 deletions

View File

@@ -24,10 +24,16 @@
<th>Passwort</th>
<td><input type="password" id="password" onkeydown="keyDown()" placeholder="Passwort *"/></td>
</tr>
<tr id="error" style="display: none">
<tr id="error_login_failed" class="warn" style="display: none">
<th>Fehler</th>
<td class="warning">Anmeldung fehlgeschlagen!</td>
</tr>
<tr id="error_locked" class="warn" style="display: none">
<th>Fehler</th>
<td class="warning">
Account gesperrt bis <span id="release"></span>
</td>
</tr>
<tr>
<td colspan="2">
<label>
@@ -47,11 +53,11 @@
</table>
</fieldset>
<div id="sent" class="warning" style="display: none">
Ein Link zum Zurücksetzen ihres Passworts wurde ihnen per Mail gesendet.
Ein Link zum Zurücksetzen Ihres Passworts wurde ihnen per Mail gesendet.
</div>
</div>
<div id="ad">
Dieser minimale Login-Service wird durch <b>SRSoftware</b> zur Verfügung gestellt. <a href="https://git.srsoftware.de/StephanRichter/LightOidc">Mehr erfahren…</a>
Dieser leichtgewichtige Login-Service wird durch <b>SRSoftware</b> zur Verfügung gestellt. <a href="https://git.srsoftware.de/StephanRichter/LightOidc">Mehr erfahren…</a>
</div>
</body>
</html>

View File

@@ -24,10 +24,16 @@
<th>Password</th>
<td><input type="password" id="password" onkeydown="keyDown()" placeholder="Password *"/></td>
</tr>
<tr id="error" style="display: none">
<tr id="error_login_failed" class="warn" style="display: none">
<th>Error</th>
<td class="warning">Failed to log in!</td>
</tr>
<tr id="error_locked" class="warn" style="display: none">
<th>Error</th>
<td class="warning">
Your account is locked until <span id="release"></span>
</td>
</tr>
<tr>
<td colspan="2">
<label>

View File

@@ -5,6 +5,7 @@ function doRedirect(){
}
function handleLogin(response){
hideAll('warn');
if (response.ok){
response.headers.forEach(function(val, key) {
console.log('header: '+key+' → '+val);
@@ -15,12 +16,12 @@ function handleLogin(response){
document.cookie = val;
}
});
response.json().then(body => {
hide('error');
setTimeout(doRedirect,100);
});
response.json().then(body => setTimeout(doRedirect,100));
} else {
show('error');
response.json().then(json => {
if (json.metadata.release) get('release').innerHTML = new Date(json.metadata.release).toLocaleString();
show(json.error);
});
}
}