1

I am having an issue that I just can't figure out at all. It's two parts.

I have a splash page which requires users to enter a Beta code. If the code is valid, they are redirected to a registration page. If they register correctly, they are authenticated in Django and are redirected to the site's homepage. All the pages in the site, save for splash and register, have @login_required decorators.

Now bizarrely, some of my test users are claiming that they get signed in and then redirected to splash page randomly. I can't reproduce that and several of my other testers also can't reproduce that error. I don't understand it at all.

Even more strange, though, is the fact that I can't successfully authenticate the user at all in IE8. It just keeps redirecting me back to splash page in IE8, even though the same code is working for me on other browsers. But wait, there's more, I tested it on a friend's computer today and IE8 worked on their computer.

What the hell, I'm so frustrated. Some basic thoughts on where I can start with this?

EDIT:

Here is my splash page view:

def splash(request):

  error=''
  #request.session.set_test_cookie()

  if request.method=="POST": 
    #if request.session.test_cookie_worked():
    #   request.session.delete_test_cookie()
    #else:
    #   cookie_error="You must enable cookies in your browser to use our login system. Our cookies will not track your behavior outside this site or do anything else malicious"
    #   return render_to_response("website/splash.html", {'cookie_error':cookie_error}, context_instance=RequestContext(request))   

    if request.POST.get('email_list',''):
        beta_testform=Beta_TestForm(request.POST)
        if beta_testform.is_valid():
            beta=beta_testform.save()
            return HttpResponseRedirect('/splash/?mls=True')
        else:   
            email_error="Please enter a valid email address"
            return render_to_response("website/splash.html", {'email_error':email_error},context_instance=RequestContext(request))
    if request.POST.get('code'):
        hardcode='codehere'
        code=request.POST.get('code','')
        if hardcode==code:
            request.session['beta']=True
            return HttpResponseRedirect('/splash/register/')
            return HttpResponseRedirect('/')
        else:
            beta_error='Please enter a valid Beta code'
            return render_to_response("website/splash.html", {'beta_error':beta_error}, context_instance=RequestContext(request))

Here is a link to another thread I started (which went unanswered). It contains my register page view

https://stackoverflow.com/questions/5758598/decorator-or-session-fail-bug-only-occurs-for-of-users

UPDATE... apparently this intermittent session breakages has been an issue for other people as well. Django session intermittently disappears just after login

Community
  • 1
  • 1
Ben
  • 15,010
  • 11
  • 58
  • 90
  • Do you have code that illustrates the problem? Whittle it down to the simplest versions that do not work as expected. – Mike Ramirez Apr 25 '11 at 02:01
  • A live site would be helpful as well for this type of problem, so that we could probe it ourselves. I suspect it's some sort of cookie or header issue, perhaps a problem with your server setup. – brianpeiris Apr 25 '11 at 02:05
  • Brian, my server set up is contained here: http://stackoverflow.com/questions/5765706/apache-config-to-hook-ssl-into-django – Ben Apr 25 '11 at 02:10
  • Ok so here's one useful piece of info. I cleared my cookies in IE8 and it started to work. I am still befuddled – Ben Apr 25 '11 at 02:39
  • Having the same issue (but not able to fix it by clearing the cookies), I've found this: http://stackoverflow.com/questions/2705235/django-test-failing-on-a-view-with-login-required – StefanNch Nov 03 '11 at 09:30

0 Answers0