Split login error messages

cancel
Showing results for 
Search instead for 
Did you mean: 
younotimba
Member II

Split login error messages

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.

1 Reply
douglascrp
Advanced II

Re: Split login error messages

Hello.

You should take a look at the webscript responsible for generating the login form.

All the code is available at share/share/src/main/resources/alfresco/site-webscripts/org/alfresco/components/guest at master · Al... 

As you can see, the webscript controller has been written with Javascript, and the error is defined here share/login.get.js at master · Alfresco/share · GitHub 

But it seems the error itself is never read or exposed to the final user share/login.get.html.ftl at master · Alfresco/share · GitHub