WebAuthN: Replace sr-only with hidden css-class

This commit is contained in:
Martin Gross
2025-05-22 17:13:11 +02:00
parent 7756b6745c
commit 465171f323
4 changed files with 5 additions and 5 deletions

View File

@@ -14,7 +14,7 @@
<input class="form-control" name="token" placeholder="{% trans "Token" %}" autocomplete="one-time-code" <input class="form-control" name="token" placeholder="{% trans "Token" %}" autocomplete="one-time-code"
type="text" required="required" autofocus="autofocus" id="webauthn-response"> type="text" required="required" autofocus="autofocus" id="webauthn-response">
</div> </div>
<div class="sr-only alert alert-danger" id="webauthn-error"> <div class="alert alert-danger hidden" id="webauthn-error">
{% trans "WebAuthn failed. Check that the correct authentication device is correctly plugged in." %} {% trans "WebAuthn failed. Check that the correct authentication device is correctly plugged in." %}
</div> </div>
{% if jsondata %} {% if jsondata %}

View File

@@ -22,7 +22,7 @@
<button class="btn btn-primary sr-only" type="submit"></button> <button class="btn btn-primary sr-only" type="submit"></button>
</form> </form>
<div class="sr-only alert alert-danger" id="webauthn-error"> <div class="alert alert-danger hidden" id="webauthn-error">
{% trans "Device registration failed." %} {% trans "Device registration failed." %}
</div> </div>
<script type="text/json" id="webauthn-enroll"> <script type="text/json" id="webauthn-enroll">

View File

@@ -18,7 +18,7 @@
<input class="form-control" id="webauthn-response" name="webauthn" <input class="form-control" id="webauthn-response" name="webauthn"
type="hidden"> type="hidden">
{% if jsondata %} {% if jsondata %}
<div class="sr-only alert alert-danger" id="webauthn-error"> <div class="alert alert-danger hidden" id="webauthn-error">
{% trans "WebAuthn failed. Check that the correct authentication device is correctly plugged in." %} {% trans "WebAuthn failed. Check that the correct authentication device is correctly plugged in." %}
</div> </div>
<p><small> <p><small>

View File

@@ -145,7 +145,7 @@ const startRegister = async (e) => {
publicKey: publicKeyCredentialCreateOptions publicKey: publicKeyCredentialCreateOptions
}); });
} catch (err) { } catch (err) {
$("#webauthn-error").removeClass("sr-only"); $("#webauthn-error").removeClass("hidden");
return console.error("Error creating credential:", err); return console.error("Error creating credential:", err);
} }
@@ -170,7 +170,7 @@ const startLogin = async (e) => {
publicKey: transformedCredentialRequestOptions, publicKey: transformedCredentialRequestOptions,
}); });
} catch (err) { } catch (err) {
$("#webauthn-error").removeClass("sr-only"); $("#webauthn-error").removeClass("hidden");
return console.error("Error when creating credential:", err); return console.error("Error when creating credential:", err);
} }