From 8351116d925c4d1c42a6a51a404af37879738022 Mon Sep 17 00:00:00 2001 From: Koki Takahashi Date: Sat, 2 Oct 2021 18:34:05 +0900 Subject: [PATCH] Validate email on oauth registration --- CTFd/auth.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CTFd/auth.py b/CTFd/auth.py index 7a8927cd38..af105aff98 100644 --- a/CTFd/auth.py +++ b/CTFd/auth.py @@ -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