Friday, January 30, 2015

Re: How to detect (daily) User Login when using cookies?

Hi,

If you use a custom authentication backend, you could update it every time get_user(request) is called.

Collin

On Wednesday, January 28, 2015 at 4:58:30 AM UTC-5, Tobias Dacoir wrote:
Yes that would be enough. I know in the User Model there is last_login but that is only updated when the User actually logs in. And the signal from django-allauth is also only send when the user uses the login form. The only other alternative I found was to check in every view I have for request.user and store / update datetime.now. But this is quite ugly.


On Tuesday, January 27, 2015 at 9:00:15 PM UTC+1, Collin Anderson wrote:
Hi,

Would it make sense to simply keep a record of when the last time you've seen the user is?

Collin

On Friday, January 23, 2015 at 4:43:41 AM UTC-5, Tobias Dacoir wrote:
I'm using django-allauth and I receive a signal when a user logs in. Now I want to store each day the user logs in. However, when the user does not logout he can still log in the next day thanks to the cookies. I know that I can set SESSION_EXPIRE_AT_BROWSER_CLOSE to True in settings.py. But this may annoy some Users.

So is there a way to use cookies but still tell if a User has accessed the site for the first time today?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d2d6d493-2c95-43c1-a1ae-c08b9e0fbea4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment