Merge branch 'fix-reference-before-assignment' into 'master'

[FIX] Reference before assignment

Closes #1369 and #1375

See merge request allianceauth/allianceauth!1530
This commit is contained in:
Ariel Rin 2023-10-07 04:40:00 +00:00
commit 90dc6a4d4c

View File

@ -65,7 +65,7 @@ class StateBackend(ModelBackend):
# we've seen this character owner before. Re-attach to their old user account
user = records[0].user
if user.profile.main_character:
if ownership.user.profile.main_character.character_id != token.character_id:
if user.profile.main_character.character_id != token.character_id:
## this is an alt, enforce main only due to trust issues in SSO.
if request:
messages.error("Unable to authenticate with this Character, Please log in with the main character associated with this account. Then add this character from the dashboard.")