mirror of https://github.com/JohnHammond/CTFd.git
Add setting to allow MLC registration only (#1259)
* Adds a setting to registration visibility to allow for MLC registration while registration is disabledbulk-clear-sessions
parent
0bae69bee4
commit
7ee47b0abe
|
@ -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,
|
||||
|
|
|
@ -83,6 +83,9 @@
|
|||
<option value="private" {% if registration_visibility == 'private' %}selected{% endif %}>
|
||||
Private
|
||||
</option>
|
||||
<option value="mlc" {% if registration_visibility == 'mlc' %}selected{% endif %}>
|
||||
MajorLeagueCyber Only
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -40,3 +40,5 @@ def registration_visible():
|
|||
return True
|
||||
elif v == "private":
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue