diff --git a/CTFd/auth.py b/CTFd/auth.py index 10ecfe1..93ca3bb 100644 --- a/CTFd/auth.py +++ b/CTFd/auth.py @@ -11,6 +11,7 @@ from CTFd.utils import config, email, get_app_config, get_config from CTFd.utils import user as current_user from CTFd.utils import validators from CTFd.utils.config import is_teams_mode +from CTFd.utils.config.integrations import mlc_registration from CTFd.utils.config.visibility import registration_visible from CTFd.utils.crypto import verify_password from CTFd.utils.decorators import ratelimit @@ -384,7 +385,7 @@ def oauth_redirect(): user = Users.query.filter_by(email=user_email).first() if user is None: # Check if we are allowing registration before creating users - if registration_visible(): + if registration_visible() or mlc_registration(): user = Users( name=user_name, email=user_email, diff --git a/CTFd/themes/admin/templates/configs/settings.html b/CTFd/themes/admin/templates/configs/settings.html index 813586d..59e2d90 100644 --- a/CTFd/themes/admin/templates/configs/settings.html +++ b/CTFd/themes/admin/templates/configs/settings.html @@ -83,6 +83,9 @@ + diff --git a/CTFd/utils/config/integrations.py b/CTFd/utils/config/integrations.py index 137948c..dbaf97f 100644 --- a/CTFd/utils/config/integrations.py +++ b/CTFd/utils/config/integrations.py @@ -3,3 +3,8 @@ from CTFd.utils import get_config def mlc(): return get_config("oauth_client_id") and get_config("oauth_client_secret") + + +def mlc_registration(): + v = get_config("registration_visibility") + return v == "mlc" diff --git a/CTFd/utils/config/visibility.py b/CTFd/utils/config/visibility.py index 45448fc..f933797 100644 --- a/CTFd/utils/config/visibility.py +++ b/CTFd/utils/config/visibility.py @@ -40,3 +40,5 @@ def registration_visible(): return True elif v == "private": return False + else: + return False