From 73f1ae5ca6ff8886960cd0eb89d46a9f4af86cb4 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 11 Jan 2024 22:02:25 +0100 Subject: [PATCH] fix: webauthn set up device button cherry-pick of https://github.com/keycloak/keycloak/commit/1af4a7a5325c248da2275759379ec00e495045df and https://github.com/keycloak/keycloak/commit/ee35cfe47862c016495f724b80a35c81f552a468 --- login/login-config-totp.ftl | 7 ++++++- login/login-recovery-authn-code-config.ftl | 8 +++++--- login/login-update-password.ftl | 13 +++---------- login/password-commons.ftl | 12 ++++++++++++ login/update-email.ftl | 3 +++ login/webauthn-register.ftl | 10 ++++++---- 6 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 login/password-commons.ftl diff --git a/login/login-config-totp.ftl b/login/login-config-totp.ftl index 8014585..5b21da4 100644 --- a/login/login-config-totp.ftl +++ b/login/login-config-totp.ftl @@ -1,4 +1,5 @@ <#import "template.ftl" as layout> +<#import "password-commons.ftl" as passwordCommons> <@layout.registrationLayout displayRequiredFields=false displayMessage=!messagesPerField.existsError('totp','userLabel'); section> <#if section = "header"> @@ -88,6 +89,10 @@ +
+ <@passwordCommons.logoutOtherSessions/> +
+ <#if isAppInitiatedAction??> - \ No newline at end of file + diff --git a/login/login-recovery-authn-code-config.ftl b/login/login-recovery-authn-code-config.ftl index 5bd3559..ef81710 100644 --- a/login/login-recovery-authn-code-config.ftl +++ b/login/login-recovery-authn-code-config.ftl @@ -1,4 +1,5 @@ <#import "template.ftl" as layout> +<#import "password-commons.ftl" as passwordCommons> <@layout.registrationLayout; section> <#if section = "header"> @@ -38,17 +39,18 @@ -
+
- +
-
+ + <@passwordCommons.logoutOtherSessions/> <#if isAppInitiatedAction??> +<#import "password-commons.ftl" as passwordCommons> <@layout.registrationLayout displayMessage=!messagesPerField.existsError('password','password-confirm'); section> <#if section = "header"> ${msg("updatePasswordTitle")} @@ -47,15 +48,7 @@
-
-
- <#if isAppInitiatedAction??> -
- -
- -
-
+ <@passwordCommons.logoutOtherSessions/>
<#if isAppInitiatedAction??> @@ -68,4 +61,4 @@
- \ No newline at end of file + diff --git a/login/password-commons.ftl b/login/password-commons.ftl new file mode 100644 index 0000000..233c781 --- /dev/null +++ b/login/password-commons.ftl @@ -0,0 +1,12 @@ +<#macro logoutOtherSessions> +
+
+
+ +
+
+
+ diff --git a/login/update-email.ftl b/login/update-email.ftl index 4c85e5b..e63b012 100644 --- a/login/update-email.ftl +++ b/login/update-email.ftl @@ -1,4 +1,5 @@ <#import "template.ftl" as layout> +<#import "password-commons.ftl" as passwordCommons> <@layout.registrationLayout displayMessage=!messagesPerField.existsError('email'); section> <#if section = "header"> ${msg("updateEmailTitle")} @@ -28,6 +29,8 @@
+ <@passwordCommons.logoutOtherSessions/> +
<#if isAppInitiatedAction??> diff --git a/login/webauthn-register.ftl b/login/webauthn-register.ftl index 1beb31e..3083ce5 100644 --- a/login/webauthn-register.ftl +++ b/login/webauthn-register.ftl @@ -1,4 +1,6 @@ <#import "template.ftl" as layout> + <#import "password-commons.ftl" as passwordCommons> + <@layout.registrationLayout; section> <#if section = "title"> title @@ -15,6 +17,7 @@ + <@passwordCommons.logoutOtherSessions/>
@@ -35,7 +38,7 @@ let userid = "${userid}"; let username = "${username}"; - let signatureAlgorithms = "${signatureAlgorithms}"; + let signatureAlgorithms =[<#list signatureAlgorithms as sigAlg>${sigAlg},] let pubKeyCredParams = getPubKeyCredParams(signatureAlgorithms); let rpEntityName = "${rpEntityName}"; @@ -127,13 +130,12 @@ }); } - function getPubKeyCredParams(signatureAlgorithms) { + function getPubKeyCredParams(signatureAlgorithmsList) { let pubKeyCredParams = []; - if (signatureAlgorithms === "") { + if (signatureAlgorithmsList === []) { pubKeyCredParams.push({type: "public-key", alg: -7}); return pubKeyCredParams; } - let signatureAlgorithmsList = signatureAlgorithms.split(','); for (let i = 0; i < signatureAlgorithmsList.length; i++) { pubKeyCredParams.push({