Fix potential issue with existing user query matching multiple users

This commit is contained in:
rubenwardy 2024-06-02 12:48:06 +01:00
parent bce06d45d0
commit bb39f268d3

@ -105,7 +105,7 @@ def callback(oauth_token):
else: else:
existing_user = (User.query existing_user = (User.query
.filter(or_(User.username == github_username, User.forums_username == github_username)) .filter(or_(User.username == github_username, User.forums_username == github_username))
.one_or_none()) .first())
if existing_user: if existing_user:
flash(gettext("Unable to create an account as the username is already taken. " flash(gettext("Unable to create an account as the username is already taken. "
"If you meant to log in, you need to connect GitHub to your account first"), "danger") "If you meant to log in, you need to connect GitHub to your account first"), "danger")