-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
translations
Describe the bug
There is an extra character in the email themes parameters which causes an error when sending the email. Specifically, in the theme\base\email\messages\messages_es.properties file, the key identityProviderLinkBodyHtml:
identityProviderLinkBodyHtml=<p>Alguien quiere vincular su <b>{1}</b> cuenta con <b>{0}</b> cuenta del usuario {2}. Si ha sido usted, haga clic en el siguiente enlace para vincular las cuentas</p><p><a href="{3h}">Enlace para confirmar el vínculo de cuentas</a></p><p>Este enlace expirará en {5}.</p><p>Si no desea vincular la cuenta, simplemente ignore este mensaje. Si vincula las cuentas, podrá iniciar sesión en {1} a través de {0}.</p>The parameter {3h} should be {3}. This causes and error when attempting to send the email
Version
25.0.0
Regression
- The issue is a regression
Expected behavior
The email should be sent successfully with the correct url for account linking. The template parameter {3h} should be {3}.
Example of another message file (messages_de.properties)
identityProviderLinkBodyHtml=<p>Es wurde beantragt Ihren Account <b>{1}</b> mit dem Account <b>{0}</b> von Benutzer {2} zu verlinken. Sollten Sie dies beantragt haben, klicken Sie auf den unten stehenden Link.</p><p><a href="{3}">Link zur Bestätigung der Kontoverknüpfung</a></p><p>Der Link ist {5} gültig.</p><p>Sollten Sie Ihren Account nicht verlinken wollen, ignorieren Sie diese Nachricht. Wenn Sie die Accounts verlinken wird ein Login auf {1} über {0} ermöglicht.</p>Actual behavior
The email fails to send due to the incorrect parameter, causing a java.lang.NumberFormatException.
Full error:
2024-06-19 16:22:10 2024-06-19 21:22:10,611 WARN [org.keycloak.events] (executor-thread-249) type="SEND_IDENTITY_PROVIDER_LINK_ERROR", realmId="<id>", realmName="Hannami", clientId="account-console", userId="<id>", ipAddress="<ip>", error="email_send_failed", identity_provider="github", redirect_uri="http://localhost:9090/realms/Hannami/account/", identity_provider_identity="<id>", code_id="<id>", email="[email protected]", username="[email protected]"
2024-06-19 16:22:10 2024-06-19 21:22:10,611 ERROR [org.keycloak.services] (executor-thread-249) KC-SERVICES0021: Failed to send email to confirm identity broker linking: org.keycloak.email.EmailException: Failed to template email
2024-06-19 16:22:10 at org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.processTemplate(FreeMarkerEmailTemplateProvider.java:247)
2024-06-19 16:22:10 at org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.send(FreeMarkerEmailTemplateProvider.java:262)
2024-06-19 16:22:10 at org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.send(FreeMarkerEmailTemplateProvider.java:257)
2024-06-19 16:22:10 at org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.sendConfirmIdentityBrokerLink(FreeMarkerEmailTemplateProvider.java:147)
2024-06-19 16:22:10 at org.keycloak.authentication.authenticators.broker.IdpEmailVerificationAuthenticator.sendVerifyEmail(IdpEmailVerificationAuthenticator.java:149)
2024-06-19 16:22:10 at org.keycloak.authentication.authenticators.broker.IdpEmailVerificationAuthenticator.authenticateImpl(IdpEmailVerificationAuthenticator.java:89)
2024-06-19 16:22:10 at org.keycloak.authentication.authenticators.broker.IdpEmailVerificationAuthenticator.actionImpl(IdpEmailVerificationAuthenticator.java:102)
2024-06-19 16:22:10 at org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.action(AbstractIdpAuthenticator.java:93)
2024-06-19 16:22:10 at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:151)
2024-06-19 16:22:10 at org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:1031)
2024-06-19 16:22:10 at org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:376)
2024-06-19 16:22:10 at org.keycloak.services.resources.LoginActionsService.brokerLoginFlow(LoginActionsService.java:938)
2024-06-19 16:22:10 at org.keycloak.services.resources.LoginActionsService.firstBrokerLoginGet(LoginActionsService.java:810)
2024-06-19 16:22:10 at org.keycloak.services.resources.LoginActionsService$quarkusrestinvoker$firstBrokerLoginGet_4319965f5ab7d0aadd2e5b5f2cde702e4aaaf535.invoke(Unknown Source)
2024-06-19 16:22:10 at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
2024-06-19 16:22:10 at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
2024-06-19 16:22:10 at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
2024-06-19 16:22:10 at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:582)
2024-06-19 16:22:10 at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
2024-06-19 16:22:10 at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
2024-06-19 16:22:10 at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
2024-06-19 16:22:10 at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
2024-06-19 16:22:10 at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2024-06-19 16:22:10 at java.base/java.lang.Thread.run(Thread.java:1583)
2024-06-19 16:22:10 Caused by: org.keycloak.email.EmailException: Failed to template html email.
2024-06-19 16:22:10 at org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.processTemplate(FreeMarkerEmailTemplateProvider.java:242)
2024-06-19 16:22:10 ... 23 more
2024-06-19 16:22:10 Caused by: org.keycloak.theme.FreeMarkerException: Failed to process template html/identity-provider-link.ftl
2024-06-19 16:22:10 at org.keycloak.theme.freemarker.DefaultFreeMarkerProvider.processTemplate(DefaultFreeMarkerProvider.java:52)
2024-06-19 16:22:10 at org.keycloak.email.freemarker.FreeMarkerEmailTemplateProvider.processTemplate(FreeMarkerEmailTemplateProvider.java:240)
2024-06-19 16:22:10 ... 23 more
2024-06-19 16:22:10 Caused by: java.lang.IllegalArgumentException: can't parse argument number: 3h
2024-06-19 16:22:10 at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1479)
2024-06-19 16:22:10 at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:511)
2024-06-19 16:22:10 at java.base/java.text.MessageFormat.<init>(MessageFormat.java:410)
2024-06-19 16:22:10 at org.keycloak.theme.beans.MessageFormatterMethod.exec(MessageFormatterMethod.java:62)
2024-06-19 16:22:10 at freemarker.core.MethodCall._eval(MethodCall.java:62)
2024-06-19 16:22:10 at freemarker.core.Expression.eval(Expression.java:101)
2024-06-19 16:22:10 at freemarker.core.ListLiteral.getModelList(ListLiteral.java:92)
2024-06-19 16:22:10 at freemarker.core.MethodCall._eval(MethodCall.java:60)
2024-06-19 16:22:10 at freemarker.core.Expression.eval(Expression.java:101)
2024-06-19 16:22:10 at freemarker.core.BuiltInsForOutputFormatRelated$AbstractConverterBI.calculateResult(BuiltInsForOutputFormatRelated.java:50)
2024-06-19 16:22:10 at freemarker.core.MarkupOutputFormatBoundBuiltIn._eval(MarkupOutputFormatBoundBuiltIn.java:40)
2024-06-19 16:22:10 at freemarker.core.Expression.eval(Expression.java:101)
2024-06-19 16:22:10 at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104)
2024-06-19 16:22:10 at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
2024-06-19 16:22:10 at freemarker.core.Environment.visit(Environment.java:371)
2024-06-19 16:22:10 at freemarker.core.Environment.invokeNestedContent(Environment.java:621)
2024-06-19 16:22:10 at freemarker.core.BodyInstruction.accept(BodyInstruction.java:60)
2024-06-19 16:22:10 at freemarker.core.Environment.visit(Environment.java:371)
2024-06-19 16:22:10 at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:877)
2024-06-19 16:22:10 at freemarker.core.Environment.invokeMacro(Environment.java:813)
2024-06-19 16:22:10 at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84)
2024-06-19 16:22:10 at freemarker.core.Environment.visit(Environment.java:335)
2024-06-19 16:22:10 at freemarker.core.Environment.visit(Environment.java:341)
2024-06-19 16:22:10 at freemarker.core.Environment.process(Environment.java:314)
2024-06-19 16:22:10 at freemarker.template.Template.process(Template.java:383)
2024-06-19 16:22:10 at org.keycloak.theme.freemarker.DefaultFreeMarkerProvider.processTemplate(DefaultFreeMarkerProvider.java:49)
2024-06-19 16:22:10 ... 24 more
2024-06-19 16:22:10 Caused by: java.lang.NumberFormatException: For input string: "3h"
2024-06-19 16:22:10 at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
2024-06-19 16:22:10 at java.base/java.lang.Integer.parseInt(Integer.java:662)
2024-06-19 16:22:10 at java.base/java.lang.Integer.parseInt(Integer.java:778)
2024-06-19 16:22:10 at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1477)
2024-06-19 16:22:10 ... 49 more
2024-06-19 16:22:10
How to Reproduce?
-
Enable Internationalization in "master" realm, add "spanish" in Supported locales and set this language as Default locale
-
Go to the Account Console and log in with a registered account (e.g., using Google). Then, attempt to sign in with another Identity Provider (IdP) in my case GitHub, and complete the form using the same email address as the registered account.
Anything else?
No response