mirror of
https://gitlab.com/brutaldon/brutaldon
synced 2024-12-26 15:53:54 +01:00
Fix bug: can't switch accounts after using old login mode
Problem reason: account.id might not be available before account.save(), if the account is newly-created Changes: switches .save() call and accounts_dict update, to ensure that the .id is available in accounts_dict Note: this bugfix only fixes logins after this change. If you’ve logged in using the old code, your session data still won't have ID. You need to log out of all the accounts and then log in again.
This commit is contained in:
parent
28aae9942a
commit
f9839ea5cb
@ -583,6 +583,7 @@ def old_login(request):
|
||||
account.username = request.session["active_username"]
|
||||
request.session["timezone"] = account.preferences.timezone
|
||||
|
||||
account.save()
|
||||
accounts_dict = request.session.get("accounts_dict")
|
||||
if not accounts_dict:
|
||||
accounts_dict = {}
|
||||
@ -591,7 +592,6 @@ def old_login(request):
|
||||
"user": user,
|
||||
}
|
||||
request.session["accounts_dict"] = accounts_dict
|
||||
account.save()
|
||||
|
||||
return redirect(home)
|
||||
except IntegrityError:
|
||||
|
Loading…
Reference in New Issue
Block a user