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 committed Feb 23, 2025
1 parent 415351b commit f64a588
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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': getattr(settings, 'REGISTRATION_OPEN', True),
'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 f64a588

Please sign in to comment.