π OpenHands: AI-Driven Development
Add variable to disable duplicate email check (#12474)
chuckbutkusa07fc1510bb3
diff --git a/enterprise/server/auth/constants.py b/enterprise/server/auth/constants.pyindex 867e97c13d..df6e9aef54 100644--- a/enterprise/server/auth/constants.py+++ b/enterprise/server/auth/constants.py@@ -39,6 +39,8 @@ ROLE_CHECK_ENABLED = os.getenv('ROLE_CHECK_ENABLED', 'false').lower() in ('on',)+DUPLICATE_EMAIL_CHECK = os.getenv('DUPLICATE_EMAIL_CHECK', 'true') in ('1', 'true')+# reCAPTCHA EnterpriseRECAPTCHA_PROJECT_ID = os.getenv('RECAPTCHA_PROJECT_ID', '').strip()RECAPTCHA_SITE_KEY = os.getenv('RECAPTCHA_SITE_KEY', '').strip()diff --git a/enterprise/server/auth/token_manager.py b/enterprise/server/auth/token_manager.pyindex 1c641a094c..4e5b4316df 100644--- a/enterprise/server/auth/token_manager.py+++ b/enterprise/server/auth/token_manager.py@@ -19,6 +19,7 @@ from keycloak.exceptions import (from server.auth.constants import (BITBUCKET_APP_CLIENT_ID,BITBUCKET_APP_CLIENT_SECRET,+ DUPLICATE_EMAIL_CHECK,GITHUB_APP_CLIENT_ID,GITHUB_APP_CLIENT_SECRET,GITLAB_APP_CLIENT_ID,@@ -646,6 +647,10 @@ class TokenManager:if not email:return False+ # We have the option to skip the duplicate email check in test environments+ if not DUPLICATE_EMAIL_CHECK:+ return False+base_email = extract_base_email(email)if not base_email:logger.warning(f'Could not extract base email from: {email}')