Saturday, May 29, 2010

Re: What would be the best way to implement a login audit?

It would be nice if contrib.auth threw signals for auth attempts.

I don't think a custom auth backend would be the best solution, because a custom auth backend as described in the documentation doesn't receive the request object, which is where the stuff you want (such as IP address) can be accessed.

It seems like the easiest place to add this would be in your login view.
http://docs.djangoproject.com/en/1.1/topics/auth/#how-to-log-a-user-in

Based on the docs there, you will have a view which has access both to the request object and the knowledge of the success or failure of the login.

Shawn

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment