Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide sign up button when registration is disabled #2407

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dmoj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@
'django.contrib.auth.backends.ModelBackend',
)

REGISTRATION_OPEN = True

SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
Expand Down
1 change: 1 addition & 0 deletions judge/template_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def general_info(request):
'nav_tab': FixedSimpleLazyObject(partial(__nav_tab, request.path)),
'nav_bar': NavigationBar.objects.all(),
'LOGIN_RETURN_PATH': '' if path.startswith('/accounts/') else path,
'REGISTRATION_OPEN': settings.REGISTRATION_OPEN,
'perms': PermWrapper(request.user),
'HAS_WEBAUTHN': bool(settings.WEBAUTHN_RP_ID),
}
Expand Down
6 changes: 4 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@
{% else %}
<span class="anon">
<a href="{{ url('auth_login') }}?next={{ LOGIN_RETURN_PATH|urlencode }}"><b>{{ _('Log in') }}</b></a>
&nbsp;{{ _('or') }}&nbsp;
<a href="{{ url('registration_register') }}"><b>{{ _('Sign up') }}</b></a>
{% if REGISTRATION_OPEN %}
&nbsp;{{ _('or') }}&nbsp;
<a href="{{ url('registration_register') }}"><b>{{ _('Sign up') }}</b></a>
{% endif %}
</span>
{% endif %}
</span>
Expand Down