Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected calculation of UserSocialAuthMixin.expiration_datetime #656

Closed
wants to merge 1 commit into from

Conversation

barracel
Copy link
Contributor

@barracel barracel commented Apr 3, 2013

Corrected calculation of "now timestamp" in utc.

datetime.now() returns a datetime in local time zone so by doing now.replace(tzinfo=utc) you are adding/removing time (depending on your configured local timezone)
I changed it to use now_timestamp because it is calculated with time.mktime and it takes into account time zones.

If you were if the side of the word where "UTC offset > than provider session time" the function UserSocialAuthMixin.expiration_datetime returned a negative time that forced the expiration of the django session.

@omab
Copy link
Owner

omab commented Apr 3, 2013

@barracel, what do you think about the code used on python-social-auth here https://github.com/omab/python-social-auth/blob/master/social/storage/base.py#L55? I was going to port it to django-social-auth shortly.

@barracel
Copy link
Contributor Author

barracel commented Apr 3, 2013

That's even better :)

@omab omab closed this in 034508f Apr 3, 2013
@omab
Copy link
Owner

omab commented Apr 3, 2013

I've ported it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants