By: matt dillenkoffer user 19 Oct 2016 at 4:24 p.m. CDT

4 Responses
matt dillenkoffer gravatar
I ran into a lot of problems using multiple login forms for different clients like we had it setup in 2.4.3. So I went with the reactive design approach moving to 2.4.4 and we now only have 1 login.xhtml form. The problem is the login failure messages are no longer showing up if the user enters the wrong username or password. Here is my modified form... <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.org/schema/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" template="/WEB-INF/incl/layout/template.xhtml"> <ui:define name="head"> <style type="text/css"> .login-panel { border-style: solid; border-width: 1px; padding: 1px; background-color: #FFFFFF; border-color: #C4C0B9; } .login-panel-header { background-color: #D4CFC7; background-image: url("#{oxAuthConfigurationService.getImgLocation()}/panel_header_bg.png"); background-position: left top; background-repeat: repeat-x; border-style: solid; border-width: 1px; padding: 2px; border-color: #D4CFC7; color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 11px; font-weight: bold; } .login-panel-body { padding: 10px; color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 11px; } </style> </ui:define> <ui:define name="pageTitle"> <h:outputText value="#{messages['login.pageTitle']}"/> </ui:define> <ui:define name="body"> <table border="0" align="center"> <tr> <td> <div> <h:form id="loginForm"> <s:token/> <h:panelGroup rendered="#{not identity.loggedIn}"> <div class="login-panel"> <div class="login-panel-header"> <h:outputText value="#{messages['login.login']}"/> </div> <div class="login-panel-body"> <ui:param name="client" value="#{clientService.getClient(sessionAttributes['client_id'])}"/> <s:div rendered='#{!empty client.getLogoUri()}'> <h:graphicImage url='#{client.getLogoUri()}'/> </s:div> <p class="info"> <!--<h:outputText value="#{messages['login.pleaseLoginHere']}"/>--> </p> <s:div rendered="#{client.getClientName() != 'DCXM'}"> <div class="dialog" oncopy="return false;" onpaste="return false;"> <h:panelGrid columns="3" border="0" rowClasses="prop" columnClasses="name,value,hint"> <h:outputLabel for="username" value="#{messages['login.username']}"/> <h:inputText id="username" value="#{credentials.username}" autocomplete="off"/> <h:outputText value=""/> <h:outputLabel for="password" value="#{messages['login.password']}"/> <h:inputSecret id="password" value="#{credentials.password}" autocomplete="off"/> <h:outputText value=""/> <!-- <h:outputLabel for="rememberMe" value="#{messages['login.rememberMe']}"/> <h:selectBooleanCheckbox id="rememberMe" value="#{rememberMe.enabled}"/>--> <h:outputText value=""/> </h:panelGrid> </div> </s:div> <s:div rendered="#{client.getClientName() == 'DCXM'}"> <div class="dialog" oncopy="return false;" onpaste="return false;" > <h:panelGrid columns="3" border="0" rowClasses="prop" columnClasses="name,value,hint"> <h:outputLabel for="username" value="#{messages['login.username']}" style="font-size:20pt"/> <h:inputText id="username" value="#{credentials.username}" autocomplete="off" style="width:480px;height:80px;font-size:28pt"/> <h:outputText value=""/> <h:outputLabel for="password" value="#{messages['login.password']}" style="font-size:20pt"/> <h:inputSecret id="password" value="#{credentials.password}" autocomplete="off" style="width:480px;height:80px;font-size:28pt"/> <h:outputText value=""/> <!-- <h:outputLabel for="rememberMe" value="#{messages['login.rememberMe']}"/> <h:selectBooleanCheckbox id="rememberMe" value="#{rememberMe.enabled}"/>--> <h:outputText value=""/> </h:panelGrid> </div> </s:div> <s:div rendered='#{!empty client.getPolicyUri()}'> <p> <h:outputText value="#{messages['common.agreePolicy']}"/> <a target="_blank" href='#{client.getPolicyUri()}'> <h:outputText value="#{messages['common.privacyPolicy']}"/> </a> </p> </s:div> <s:div rendered='#{!empty client.getTosUri()}'> <p> <h:outputText value="#{messages['common.pleaseReadTheTos']}"/> <a target="_blank" href='#{client.getTosUri()}'> <h:outputText value="#{messages['common.termsOfService']}"/> </a> </p> </s:div> <div class="actionButtons" style="overflow: hidden"> <div style="float:left;"> <s:div rendered="#{client.getClientName() != 'DCXM'}"> <h:commandButton id="loginButton" value="#{messages['login.login']}" action="#{authenticator.authenticate}"/> <s:div id="registerId" style="display:none"> <h:commandButton id="registerButton" value="#{messages['login.register']}" action="#{authenticator.authenticate}"/> </s:div> </s:div> <s:div rendered="#{client.getClientName() == 'DCXM'}"> <h:commandButton id="loginButton" value="#{messages['login.login']}" action="#{authenticator.authenticate}" style="width:100px;height:60px;font-size:24pt;"/> <s:div id="registerId" style="display:none"> <h:commandButton id="registerButton" value="#{messages['login.register']}" action="#{authenticator.authenticate}"/> </s:div> </s:div> </div> <s:div id="forgotpasswordPPdiv" style="float:right;margin-right:77px" rendered="#{client.getClientName() == 'Patient Portal'}"> <input type="button" id="forgotPasswordButton1" value="Forgot Password" onclick="navToPatientPortalForgotPassword();" style="width:100px;height:20px;font-size:8pt;white-space:normal" /> </s:div> <s:div id="forgotpasswordDCXMdiv" style="float:right;margin-right:77px" rendered="#{client.getClientName() == 'DCXM'}"> <input type="button" id="forgotPasswordButton2" value="Forgot Password" onclick="navToPatientPortalForgotPassword();" style="width:100px;height:60px;font-size:16pt;white-space:normal" /> </s:div> <s:div id="forgotpasswordAPMdiv" style="float:right;margin-right:77px" rendered="#{client.getClientName() == 'Admin Portal'}"> <input type="button" id="forgotPasswordButton3" value="Forgot Password" onclick="navToAdminPortalForgotPassword();" style="width:100px;height:20px;font-size:8pt;white-space:normal" /> </s:div> </div> </div> </div> <div class="login-panel"> <s:fragment rendered="#{external_auth_request_uri != Null}"> <a id="externalAuthButton" href="#{external_auth_request_uri}"> <input type="button" value="Use External Authentification"/> </a> </s:fragment> <s:fragment rendered="#{external_registration_uri != Null}"> <a id="externalRegistrationButton" href="#{external_registration_uri}"> <input type="button" value="Register new user"/> </a> </s:fragment> </div> </h:panelGroup> </h:form> </div> </td> </tr> </table> <script type="text/javascript"> window.onload = function () { var userNameField = document.getElementById("loginForm:username"); var passwordField = document.getElementById("loginForm:password"); var userName = '#{!empty loginAction.loginHint ? loginAction.loginHint : ""}'; if (userName) { userNameField.value = userName; userNameField.readOnly = true; passwordField.focus(); } else { userNameField.focus(); } var displayRegister = #{display_register_action or sessionAttributes['display_register_action']}; if (displayRegister) { var registerButton = document.getElementById("loginForm:registerId"); if (registerButton != null) { registerButton.style.display = 'inline'; } } }; function navToPatientPortalForgotPassword(){ var navUrl = "https://dev.medicationconx.com/web/vitality/sign-in?p_p_id=58&amp;p_p_lifecycle=0&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_col_id=column-2&amp;p_p_col_count=1&amp;_58_struts_action=%2Flogin%2Fforgot_password"; window.location.href = navUrl; } function navToAdminPortalForgotPassword(){ var navUrl = "https://dev.admin.medicationconx.com/web/vcm/sign-in?p_p_id=58&amp;p_p_lifecycle=0&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_col_id=column-2&amp;p_p_col_count=1&amp;_58_struts_action=%2Flogin%2Fforgot_password"; window.location.href = navUrl; } </script> </ui:define> </ui:composition>

By matt dillenkoffer user 19 Oct 2016 at 4:38 p.m. CDT

matt dillenkoffer gravatar
also the footer's not showing up anymore. Not sure what could have broken this functionality

By matt dillenkoffer user 19 Oct 2016 at 4:57 p.m. CDT

matt dillenkoffer gravatar
nevermind the whole problem was I was using rendered instead of c:if this form using c:if is working great. <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.org/schema/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core" template="/WEB-INF/incl/layout/template.xhtml"> <ui:define name="head"> <style type="text/css"> .login-panel { border-style: solid; border-width: 1px; padding: 1px; background-color: #FFFFFF; border-color: #C4C0B9; } .login-panel-header { background-color: #D4CFC7; background-image: url("#{oxAuthConfigurationService.getImgLocation()}/panel_header_bg.png"); background-position: left top; background-repeat: repeat-x; border-style: solid; border-width: 1px; padding: 2px; border-color: #D4CFC7; color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 11px; font-weight: bold; } .login-panel-body { padding: 10px; color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 11px; } </style> </ui:define> <ui:define name="pageTitle"> <h:outputText value="#{messages['login.pageTitle']}"/> </ui:define> <ui:define name="body"> <table border="0" align="center"> <tr> <td> <div> <h:form id="loginForm"> <s:token/> <h:panelGroup rendered="#{not identity.loggedIn}"> <div class="login-panel"> <div class="login-panel-header"> <h:outputText value="#{messages['login.login']}"/> </div> <div class="login-panel-body"> <ui:param name="client" value="#{clientService.getClient(sessionAttributes['client_id'])}"/> <s:div rendered='#{!empty client.getLogoUri()}'> <h:graphicImage url='#{client.getLogoUri()}'/> </s:div> <p class="info"> <!--<h:outputText value="#{messages['login.pleaseLoginHere']}"/>--> </p> <c:if test="#{client.getClientName() != 'DCXM'}"> <div class="dialog" oncopy="return false;" onpaste="return false;"> <h:panelGrid columns="3" border="0" rowClasses="prop" columnClasses="name,value,hint"> <h:outputLabel for="username" value="#{messages['login.username']}"/> <h:inputText id="username" value="#{credentials.username}" autocomplete="off"/> <h:outputText value=""/> <h:outputLabel for="password" value="#{messages['login.password']}"/> <h:inputSecret id="password" value="#{credentials.password}" autocomplete="off"/> <h:outputText value=""/> <!-- <h:outputLabel for="rememberMe" value="#{messages['login.rememberMe']}"/> <h:selectBooleanCheckbox id="rememberMe" value="#{rememberMe.enabled}"/>--> <h:outputText value=""/> </h:panelGrid> </div> </c:if> <c:if test="#{client.getClientName() == 'DCXM'}"> <div class="dialog" oncopy="return false;" onpaste="return false;" > <h:panelGrid columns="3" border="0" rowClasses="prop" columnClasses="name,value,hint"> <h:outputLabel for="username" value="#{messages['login.username']}" style="font-size:20pt"/> <h:inputText id="username" value="#{credentials.username}" autocomplete="off" style="width:480px;height:80px;font-size:28pt"/> <h:outputText value=""/> <h:outputLabel for="password" value="#{messages['login.password']}" style="font-size:20pt"/> <h:inputSecret id="password" value="#{credentials.password}" autocomplete="off" style="width:480px;height:80px;font-size:28pt"/> <h:outputText value=""/> <!-- <h:outputLabel for="rememberMe" value="#{messages['login.rememberMe']}"/> <h:selectBooleanCheckbox id="rememberMe" value="#{rememberMe.enabled}"/>--> <h:outputText value=""/> </h:panelGrid> </div> </c:if> <s:div rendered='#{!empty client.getPolicyUri()}'> <p> <h:outputText value="#{messages['common.agreePolicy']}"/> <a target="_blank" href='#{client.getPolicyUri()}'> <h:outputText value="#{messages['common.privacyPolicy']}"/> </a> </p> </s:div> <s:div rendered='#{!empty client.getTosUri()}'> <p> <h:outputText value="#{messages['common.pleaseReadTheTos']}"/> <a target="_blank" href='#{client.getTosUri()}'> <h:outputText value="#{messages['common.termsOfService']}"/> </a> </p> </s:div> <div class="actionButtons" style="overflow: hidden"> <div style="float:left;"> <c:if test="#{client.getClientName() != 'DCXM'}"> <h:commandButton id="loginButton" value="#{messages['login.login']}" action="#{authenticator.authenticate}"/> <s:div id="registerId" style="display:none"> <h:commandButton id="registerButton" value="#{messages['login.register']}" action="#{authenticator.authenticate}"/> </s:div> </c:if> <c:if test="#{client.getClientName() == 'DCXM'}"> <h:commandButton id="loginButton" value="#{messages['login.login']}" action="#{authenticator.authenticate}" style="width:100px;height:60px;font-size:24pt;"/> <s:div id="registerId" style="display:none"> <h:commandButton id="registerButton" value="#{messages['login.register']}" action="#{authenticator.authenticate}"/> </s:div> </c:if> </div> <s:div id="forgotpasswordPPdiv" style="float:right;margin-right:77px" rendered="#{client.getClientName() == 'Patient Portal'}"> <input type="button" id="forgotPasswordButton1" value="Forgot Password" onclick="navToPatientPortalForgotPassword();" style="width:100px;height:26px;font-size:8pt;white-space:normal" /> </s:div> <s:div id="forgotpasswordDCXMdiv" style="float:right;margin-right:77px" rendered="#{client.getClientName() == 'DCXM'}"> <input type="button" id="forgotPasswordButton2" value="Forgot Password" onclick="navToPatientPortalForgotPassword();" style="width:100px;height:60px;font-size:16pt;white-space:normal" /> </s:div> <s:div id="forgotpasswordAPMdiv" style="float:right;margin-right:77px" rendered="#{client.getClientName() == 'Admin Portal'}"> <input type="button" id="forgotPasswordButton3" value="Forgot Password" onclick="navToAdminPortalForgotPassword();" style="width:100px;height:26px;font-size:8pt;white-space:normal" /> </s:div> </div> </div> </div> <div class="login-panel"> <s:fragment rendered="#{external_auth_request_uri != Null}"> <a id="externalAuthButton" href="#{external_auth_request_uri}"> <input type="button" value="Use External Authentification"/> </a> </s:fragment> <s:fragment rendered="#{external_registration_uri != Null}"> <a id="externalRegistrationButton" href="#{external_registration_uri}"> <input type="button" value="Register new user"/> </a> </s:fragment> </div> </h:panelGroup> </h:form> </div> </td> </tr> </table> <script type="text/javascript"> window.onload = function () { var userNameField = document.getElementById("loginForm:username"); var passwordField = document.getElementById("loginForm:password"); var userName = '#{!empty loginAction.loginHint ? loginAction.loginHint : ""}'; if (userName) { userNameField.value = userName; userNameField.readOnly = true; passwordField.focus(); } else { userNameField.focus(); } var displayRegister = #{display_register_action or sessionAttributes['display_register_action']}; if (displayRegister) { var registerButton = document.getElementById("loginForm:registerId"); if (registerButton != null) { registerButton.style.display = 'inline'; } } }; function navToPatientPortalForgotPassword(){ var navUrl = "https://dev.medicationconx.com/web/vitality/sign-in?p_p_id=58&amp;p_p_lifecycle=0&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_col_id=column-2&amp;p_p_col_count=1&amp;_58_struts_action=%2Flogin%2Fforgot_password"; window.location.href = navUrl; } function navToAdminPortalForgotPassword(){ var navUrl = "https://dev.admin.medicationconx.com/web/vcm/sign-in?p_p_id=58&amp;p_p_lifecycle=0&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_col_id=column-2&amp;p_p_col_count=1&amp;_58_struts_action=%2Flogin%2Fforgot_password"; window.location.href = navUrl; } </script> </ui:define> </ui:composition>

By Aliaksandr Samuseu staff 20 Oct 2016 at 8:19 a.m. CDT

Aliaksandr Samuseu gravatar
Hi, Matt. Our usual answer to such type of a question is that Gluu doesn't get involved into pages' customization any more (even for paying customers). I still can see this error message at the default login page, so it seems problem was added by your modifications to it. I'll reassign it to our web UI programmer, may be he'll be able to suggest something.

By matt dillenkoffer user 20 Oct 2016 at 8:23 a.m. CDT

matt dillenkoffer gravatar
I found the problem. It was because I was using multiple divs that each had the same jsf component ID's in them even though only 1 was rendered at a time JSF didn't like that. I just had to use a <c:if test=blah> </c:if> instead of an <s:div rendered=blah> </s:div>