On Sep 28, 2006, at 6:26 PM, Sean Schertell wrote:
>
> (2) This is a biggie for me. I can't believe that the authentication
> module forces you to use hard coded urls for login/logout pages --
> that's just maddening! So if you want to do it your own way, you have
> to totally roll your own authentication from scratch. More work. I
> ended up hiring a guy to write a basic auth system that lets me set
> my own urls.


This isn't such a roadblock. There are many places in Django where  
you can ignore the abstractions and use the low level code. In less  
than 5 minutes, I wrote my own login/logout methods and called out to  
the basic auth methods when needed:

from django.contrib import auth
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response

def login(request):
        if request.POST:
                username = request.POST.get('username', None)
                password = request.POST.get('password', None)
                user = auth.authenticate(username=username,password=password)
                if user :
                        if not user.isactive:
                                return render_to_response('user/login.html'
                                        {'message':'This account is not 
active.'})
                        auth.login(request, user)
                        return HttpResponseRedirect('/')
        
        return render_to_response('user/login.html',
                {'message':'Please enter a username and password.'})

def logout(request):
        auth.logout(request)
        return HttpReponseRedirect('/')


Don



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to