AnsweredAssumed Answered

Split login error messages

Question asked by younotimba on Feb 6, 2017
Latest reply on Mar 9, 2017 by douglascrp

Hello.

I am looking to show specific error messages on the login page when a user has not been successful. I've been able to change LoginPost class to handle the error message, i want to display, but i dont't know, how to access this message in  login.get.html.ftl. So i want to show the WebScriptException message , cached in the following lines (LoginPost.executeImpl) :

 

try
{
   return login(username, password);
}
catch(WebScriptException e)
{
   status.setCode(e.getStatus());        
   status.setMessage(e.getMessage());   *THIS MESSAGE*  
   status.setRedirect(true);            
   return null;
}

How can i do this ?

 

Also i tried to set this message as session attribute in onFailure() method of loginController class :

 

protected void onFailure(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.getSession().setAttribute("someattr", "some message");
super.onFailure(request, response);
}

and accessing it from my ftl as : ${Session.someattr} , ${session.someattr} , ${Request.someattr}, ${RequestParameters.someattr} , but without success.

 

Thanks for any help.

Outcomes