You can simple use inbuilt user authentication provided by django.
What problem are you facing with it?


Any way if you are interested in building your own authentication
engine you need to do the following:
you can do this in several way one way is
1) Store cookie in user browser (you can store the user id (or) you
can give unique session id to this user and store relevant information
in the backend database)
      like :
       userid ============> sessionid
2) write down your middleware to check whether the request is bringing
any cookie associated with it or not.
   if yes pull the sessionid and  associate the request with this user
   if no means no user has logged in.


--rama


On Nov 6, 4:29 pm, Denis Bahati <djma...@gmail.com> wrote:
> Hi All
> Am using my own table to let users login to my django site. I don like to
> use django admin page, there fore i have created my model and a model form
> to register users so that they can login using their username and password.
>
> How can i utilize my function below so that every page is authenticated
> using this file?
>
> def mlogin(request):
>     m = User.objects.get(username=request.POST['username'])
>     if m.password == request.POST['password']:
>         request.session['member_id'] = m.id
>         #return HttpResponse("You're logged in.")
>         return HttpResponseRedirect("/commTrack/")
>     else:
>         return HttpResponse("Your username and password didn't match.")
>
> Or is there any script i can use? I have tried authenticating using the
> AUTHENTICATION_BACKENDS but i didn't get it working. May be if there is one
> to guide me on how i can set it.
> Thanks in advance.
> Regards
> Denis
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to