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
1 changed files with 3 additions and 0 deletions

View File

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