Check that GitHub doesn't pass a null user id

This commit is contained in:
rubenwardy 2024-03-30 17:06:32 +00:00
parent f5dd77fcb3
commit 64414a3731

@ -68,9 +68,11 @@ def callback(oauth_token):
json = r.json() json = r.json()
user_id = json["id"] user_id = json["id"]
username = json["login"] username = json["login"]
if type(user_id) is not int:
abort(400)
# Get user by GitHub user ID # Get user by GitHub user ID
userByGithub = User.query.filter(User.github_user_id == user_id).first() userByGithub = User.query.filter(User.github_user_id == user_id).one_or_none()
# If logged in, connect # If logged in, connect
if current_user and current_user.is_authenticated: if current_user and current_user.is_authenticated: