Skip to content

Commit

Permalink
Validate email on oauth registration
Browse files Browse the repository at this point in the history
  • Loading branch information
hakatashi committed Oct 2, 2021
1 parent c408f1e commit 8351116
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CTFd/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,13 @@ def oauth_redirect():
user_name = api_data["name"]
user_email = api_data["email"]

if user_email is None or len(user_email) == 0:
error_for(
endpoint="auth.login",
message="Email field is empty. Please contact admin",
)
return redirect(url_for("auth.login"))

user = Users.query.filter_by(email=user_email).first()
if user is None:
# Check if we are allowing registration before creating users
Expand Down

0 comments on commit 8351116

Please sign in to comment.