By: matt dillenkoffer user 22 Jul 2016 at 2:55 p.m. CDT

4 Responses
matt dillenkoffer gravatar
We are using the Gluu guide to lock out a user after 3 failed login attempts. https://gluu.org/docs/user-management/lock-user/ We used the script provided and made a few changes to fit our scenario. My question is, is there a way to display a "Your account is now locked" message to the user on the login form once we lock their account via the Python script, by login form I mean the login.xhtml form under webapps/oxauth? Thanks

By matt dillenkoffer user 27 Jul 2016 at 3:04 p.m. CDT

matt dillenkoffer gravatar
Is there a reason why you guys aren't responding to this? I realize to you guys it probably looks like a stupid question because it's probably super easy to pull this off but I don't see where the hooks are. In this guide: https://gluu.org/docs/customize/auth-script/ the author mentions: "Returning a message to the user It is possible to use the Context to return a message to the user, which could be especially useful if an error happened, or you need some kind of user action." But that's the only documentation I have found. If there is some documentation on how to set attribute values on the context and then display their values on the login.xhtml page that would be very helpful to me. Thanks

By Aliaksandr Samuseu staff 27 Jul 2016 at 3:15 p.m. CDT

Aliaksandr Samuseu gravatar
Hi, Matt. I'll assign this ticket to the member of the dev team who developed that script. Sorry for delay.

By Aliaksandr Samuseu staff 27 Jul 2016 at 3:29 p.m. CDT

Aliaksandr Samuseu gravatar
Still, may be Yuriy's privious input on a similar problem will be able to help you? The question was "What is the best way to customise the error message when authentication fails?" Here is the answer: In your custom script you can do next: 1) Add import from org.jboss.seam.faces import FacesMessages from org.jboss.seam.international import StatusMessage 2) Get FacesMessages instance and use it to add more messages: facesMessages = FacesMessages.instance() facesMessages.add(StatusMessage.Severity.ERROR, "mesage", params) 3) Also it's possible to remove default error message: facesMessages = FacesMessages.instance() facesMessages.getCurrentMessages().clear() Though, back then there was a problem reported for point 3) > The default error 'Please use correct username and password' seems to be added to the messages list after the authenticate() python interception method is called. It seems that this default message is added to the FaceMessages list when the result of authenticate() is False

By matt dillenkoffer user 29 Jul 2016 at 1:55 p.m. CDT

matt dillenkoffer gravatar
Thanks, it works, we do get the extra error message but I think I can handle removing that with some java script if there is more than 1 message in the list.