Getting there. It's not setting the logged in as yes as it's not logging me in :-)
This conditional in the login function in views if request.POST: is not getting a positive and it's falling through to the else which is setting errors to blank else: print 'balls' errors = {} request.session.set_test_cookie() return render_to_response(template_name, { 'form': oldforms.FormWrapper(manipulator, request.POST, errors), 'matts_back_to': redirect_to, 'site_name': Site.objects.get_current().name, }, context_instance=RequestContext(request)) which then throws me back to the page without logging me in at all, I can put any old rubbish into that form. I think I somehow need to make this part of the secured views do what I need, really not sure though. return HttpResponseRedirect("/accounts/login") On 08/08/07, Matt Davies <[EMAIL PROTECTED]> wrote: > > I've copied the /contrib/auth/views.py into my project and edited it like > so > > redirect_to = request.META["HTTP_REFERER"] > > return render_to_response(template_name, { > 'form': oldforms.FormWrapper (manipulator, request.POST, errors), > 'matts_back_to': redirect_to, > 'site_name': Site.objects.get_current().name, > > I've added in my login forms this as the action > > <form action="{{ matts_back_to }}" method="post"> > > Now, when a user comes to a page that shows a view that has this in the > top > if request.user.is_authenticated(): > do all your stuff > else: > return HttpResponseRedirect("/accounts/login") > > If they're not logged in they get sent to directly to the login page, they > login and get sent back to the page they were trying to access initially. > > This works fine, but for some reason the user is not being shown as having > logged in when they are returned to the initial page. If they try to access > another secured page at that point, it asks them to login again, and also > the login/logout button is showing as logged out. > > Anyone got any ideas why? > > If this is a really bad way to achieve what I want then please let me > know, it is a bit of a workaround I suppose. > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---