Skip to content

Commit

Permalink
Merge pull request #1409 from suecarmol/suecarmol/T383891-fix-new-use…
Browse files Browse the repository at this point in the history
…rs-login

Fix login for new users
  • Loading branch information
jsnshrmn authored Jan 17, 2025
2 parents aef3697 + d98b875 commit 9049c42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TWLight/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,23 +697,23 @@ def wp_bundle_authorized(self):
return self.get_bundle_authorization.is_valid

def get_global_userinfo(self, identity):
self.check_sub(identity["sub"])
self.check_sub(int(identity["sub"]))
return editor_global_userinfo(identity["sub"])

def check_sub(self, wp_sub):
"""
Verifies that the supplied Global Wikipedia User ID matches stored editor ID.
Parameters
----------
wp_sub : str
wp_sub : int
Global Wikipedia User ID, used for guiid parameter in globaluserinfo calls.
Returns
-------
None
"""

if self.wp_sub != int(wp_sub):
if int(self.wp_sub) != wp_sub:
raise SuspiciousOperation(
"Was asked to update Editor data, but the "
"WP sub in the identity passed in did not match the wp_sub on "
Expand Down Expand Up @@ -851,7 +851,7 @@ def update_from_wikipedia(
current_datetime = timezone.now()

if global_userinfo:
self.check_sub(global_userinfo["id"])
self.check_sub(int(global_userinfo["id"]))
else:
global_userinfo = self.get_global_userinfo(identity)

Expand Down

0 comments on commit 9049c42

Please sign in to comment.