0

Despite of being hard to choose a title for my question, here is the problem.

For my login page, I have managed to use spring web flow. One of the main stages in login process is that, if the user is trying to login and has provided wrong username and password more than three times, there should be a captcha verification as well. Hence, here is the captcha class:

public final class CaptchaErrorCountAction extends AbstractAction {

   private String COUNT       = "count";
   private String SHOWCAPTCHA = "showCaptcha";

   protected Event doExecute(final RequestContext context) {
      Integer count;
      HttpServletRequest request = WebUtils.getHttpServletRequest(context);
      try {
        count = (Integer) request.getSession().getAttribute("count");
        if (count == null) {
           count = 0;
        }
       } catch (Exception e) {
       count = 0;
      }
      count++;
      request.getSession().setAttribute(COUNT, count);
      request.getSession().setAttribute(SHOWCAPTCHA, true);
      return success();
     }
  }

In google chrome, everything is fine and the count variable shows the number of failed login attempts with a simple break point. But in firefox, 3rd, 6th, 9th, ... failed login attempts never gets to count++ and seemly gets lots. what would seem to be the problem?

7
  • I didn't quite understand what you are saying. Did you try using break points in the doExecute(..) method and try to execute the code line by line?
    – shyam
    May 4, 2015 at 4:53
  • that was the first thing I did. the problem is, when the application is running in google chrome the excution arrives at break point for every request, but in firefox there is one lost. I mean, after two failed login attempts, the value for count is exactly two, but for the third time, not only we have break point escape, but also the value of count still remains two.
    – Khoda
    May 4, 2015 at 5:07
  • That sure is strange. This shouldn't really have anything to do with the browser since all of the code is on the server side. Does the execution point get anywhere inside the doExecute() block?
    – shyam
    May 4, 2015 at 5:15
  • negative. but I have to add that there are multiple filters applied on application in web.xml e.g. decoder, security, ..
    – Khoda
    May 4, 2015 at 5:27
  • Then one of those filters might be the culprit preventing the code from executing.
    – shyam
    May 4, 2015 at 5:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.