1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-12-04 14:46:24 -05:00

Set timezone in session as early as possible

This commit is contained in:
Jason McBrayer 2018-08-28 12:03:17 -04:00
parent 09d36790d1
commit 20706c6271

View File

@ -196,6 +196,8 @@ def oauth_callback(request):
preferences = Preference(theme = Theme.objects.get(id=1)) preferences = Preference(theme = Theme.objects.get(id=1))
preferences.save() preferences.save()
account.preferences = preferences account.preferences = preferences
else:
request.session['timezone'] = account.preferences.timezone
account.save() account.save()
except (Account.DoesNotExist, Account.MultipleObjectsReturned): except (Account.DoesNotExist, Account.MultipleObjectsReturned):
preferences = Preference(theme = Theme.objects.get(id=1)) preferences = Preference(theme = Theme.objects.get(id=1))
@ -265,6 +267,7 @@ def old_login(request):
request.session['user'] = user request.session['user'] = user
request.session['username'] = user.username request.session['username'] = user.username
account.username = user.username account.username = user.username
request.session['timezone'] = account.preferences.timezone;
account.save() account.save()
return redirect(home) return redirect(home)