Announcement Announcement Module
Collapse
No announcement yet.
Error message not being displayed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error message not being displayed

    I am using the spring social example and modified it to use mysql database for authentication.
    If the login is incorrect it goes to

    http://localhost:8080/app/signin?par...ad_credentials
    and the signing.jsp has the following

    Code:
      		<c:if test="${param.error eq 'bad_credentials'}">
      		<div class="error">
      			Your sign in information was incorrect.
      			Please try again or <a href="<c:url value="/signup" />">sign up</a>.
      		</div>
     	 	</c:if>
      		<c:if test="${param.error eq 'multiple_users'}">
      		<div class="error">
      			Multiple local accounts are connected to the provider account.
      			Try again with a different provider or with your username and password.
      		</div>
     	 	</c:if>
    but it doesn't show the message.

    Code:
     Security.xml has the following
    
    	<http use-expressions="true" auto-config='true' access-denied-page="/signin">
    		<!-- Authentication policy -->
    		<form-login login-page="/signin" 
    			login-processing-url="/signin/authenticate" 
    			authentication-failure-url="/signin?param.error=bad_credentials" />

    Code:
    SigninController was originally returning void, but if the user is logged in I wanted to go back to home.
    
    	@RequestMapping(value="/signin", method=RequestMethod.GET)
    	public String signin(Principal currentUser, Model model) {
    		logger.debug("Signin controller");
    		if (null != currentUser){
    			return "redirect:/";
    		}
    		return null; 
    	}
    How do I get the error to show?

  • #2
    Have you tried changing your Spring Security configuration to use the parameter error rather than param.error? Using param. in JSTL is just a way of accessing HTTP parameters, it is not the prefix for the query parameter. The JSTL expression in your signing.jsp is testing to see if an HTTP parameter named error is equal to something and the redirect is specifying a query parameter by the name of param.error (they don't match). If you are having further problems I suggest you try running through the Spring Security samples which demonstrate how to do this and potentially reading up on JSTL.

    Cheers,

    Comment

    Working...
    X