Skip to content

Commit

Permalink
Hide sign up button when registration is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata authored and kiritofeng committed Feb 23, 2025
1 parent 415351b commit 4d1b682
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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

0 comments on commit 4d1b682

Please sign in to comment.