Add HTML5 attributes to prevent password manager interference with OTP

* Closes #41831

Signed-off-by: dmfilipenko <wind.fd@gmail.com>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Dmytro Filipenko 2025-08-14 09:45:53 +02:00 committed by GitHub
parent d74a10d87a
commit bd5818c4c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 3 deletions

View File

@ -99,6 +99,12 @@ When tracing is enabled, now also calls to other nodes of a {project_name} clust
To disable this kind of tracing, set the option `tracing-infinispan-enabled` to `false`.
=== Login theme optimized for OTP and recovery code entry
The input fields in the login theme for OTP and recovery codes and have been optimized:
* The input mode is now `numeric`, which will ease the input on mobile devices.
* The auto-complete is set to `one-time-code` to avoid interference with password managers.
// ------------------------ Deprecated features ------------------------ //
== Deprecated features

View File

@ -56,8 +56,9 @@
<label for="totp" class="control-label">${msg("authenticatorCode")}</label> <span class="required">*</span>
</div>
<div class="${properties.kcInputWrapperClass!}">
<input type="text" id="totp" name="totp" autocomplete="off" class="${properties.kcInputClass!}"
<input type="text" id="totp" name="totp" autocomplete="one-time-code" class="${properties.kcInputClass!}"
aria-invalid="<#if messagesPerField.existsError('totp')>true</#if>"
inputmode="numeric"
dir="ltr"
/>

View File

@ -14,9 +14,10 @@
<input tabindex="1" id="recoveryCodeInput"
name="recoveryCodeInput"
aria-invalid="<#if messagesPerField.existsError('recoveryCodeInput')>true</#if>"
autocomplete="off"
autocomplete="one-time-code"
type="text"
class="${properties.kcInputClass!}"
inputmode="numeric"
autofocus
dir="ltr"/>

View File

@ -45,6 +45,7 @@
<@group name=name label=label error=error required=required>
<span class="${properties.kcInputClass} <#if error?has_content>${properties.kcError}</#if>">
<input id="${name}" name="${name}" value="${value}" type="text" autocomplete="${autocomplete}" <#if autofocus>autofocus</#if>
<#if autocomplete == "one-time-code">inputmode="numeric"</#if>
aria-invalid="<#if error?has_content>true</#if>"/>
<@errorIcon error=error/>
</span>

View File

@ -60,8 +60,9 @@
</label>
</div>
<div class="${properties.kcInputClass!} <#if messagesPerField.existsError('totp')>pf-m-error</#if>">
<input type="text" required id="totp" name="totp" autocomplete="off"
<input type="text" required id="totp" name="totp" autocomplete="one-time-code"
aria-invalid="<#if messagesPerField.existsError('totp')>true</#if>"
inputmode="numeric"
/>
<@field.errorIcon error=kcSanitize(messagesPerField.get('totp'))?no_esc/>