diff --git a/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl b/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl index 24a64078..9c10ebe2 100644 --- a/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +++ b/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl @@ -331,23 +331,27 @@ function decodeHtmlEntities(htmlStr){ <#list fieldNames as fieldName> <#-- See: https://github.com/keycloakify/keycloakify/issues/217 --> - <#if fieldName == "username"> + <#if pageId === "login.ftl" > - <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ "> + <#if fieldName == "username"> - <#if messagesPerField.exists('username') || messagesPerField.exists('password')> - <#local jsFunctionCode += "return out.message && out.message.summary ? out.message.summary : 'error'; "> - <#else> - <#local jsFunctionCode += "return ''; "> + <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ "> + + <#if messagesPerField.exists('username') || messagesPerField.exists('password')> + <#local jsFunctionCode += "return out.message && out.message.summary ? out.message.summary : 'error'; "> + <#else> + <#local jsFunctionCode += "return ''; "> + + + <#local jsFunctionCode += "} "> + + <#continue> - <#local jsFunctionCode += "} "> + <#if fieldName == "password"> + <#continue> + - <#continue> - - - <#if fieldName == "password"> - <#continue> <#local jsFunctionCode += "if(fieldName === '" + fieldName + "'){ "> @@ -375,23 +379,25 @@ function decodeHtmlEntities(htmlStr){ <#list fieldNames as fieldName> <#-- See: https://github.com/keycloakify/keycloakify/issues/217 --> - <#if fieldName == "username"> + <#if pageId === "login.ftl" > + <#if fieldName == "username"> - <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ "> + <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ "> - <#if messagesPerField.existsError('username') || messagesPerField.existsError('password')> - <#local jsFunctionCode += "return true; "> - <#else> - <#local jsFunctionCode += "return false; "> + <#if messagesPerField.existsError('username') || messagesPerField.existsError('password')> + <#local jsFunctionCode += "return true; "> + <#else> + <#local jsFunctionCode += "return false; "> + + + <#local jsFunctionCode += "} "> + + <#continue> - <#local jsFunctionCode += "} "> - - <#continue> - - - <#if fieldName == "password"> - <#continue> + <#if fieldName == "password"> + <#continue> + <#local jsFunctionCode += "if(fieldName === '" + fieldName + "' ){ ">