mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 14:34:53 +03:00
Hides 'sign up' elements when ACCOUNT_ALLOW_REGISTRATION is disabled
This commit is contained in:
parent
66b1468fda
commit
3b20e4985b
|
@ -175,6 +175,7 @@ Listed in alphabetical order.
|
|||
Vivian Guillen `@viviangb`_
|
||||
Will Farley `@goldhand`_ @g01dhand
|
||||
William Archinal `@archinal`_
|
||||
Will Gordon `@wgordon17` @wpg4665
|
||||
Yaroslav Halchenko
|
||||
Denis Bobrov `@delneg`_
|
||||
Philipp Matthies `@canonnervio`_
|
||||
|
@ -291,6 +292,7 @@ Listed in alphabetical order.
|
|||
.. _@brentpayne: https://github.com/brentpayne
|
||||
.. _@afrowave: https://github.com/afrowave
|
||||
.. _@pchiquet: https://github.com/pchiquet
|
||||
.. _@wgordon17: https://github.com/wgordon17
|
||||
.. _@delneg: https://github.com/delneg
|
||||
.. _@purplediane: https://github.com/purplediane
|
||||
.. _@umrashrf: https://github.com/umrashrf
|
||||
|
|
|
@ -195,6 +195,7 @@ TEMPLATES = [
|
|||
'django.template.context_processors.static',
|
||||
'django.template.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'{{cookiecutter.project_slug}}.users.context_processors.allauth_settings',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -13,25 +13,33 @@
|
|||
{% get_providers as socialaccount_providers %}
|
||||
|
||||
{% if socialaccount_providers %}
|
||||
<p>{% blocktrans with site.name as site_name %}Please sign in with one
|
||||
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
|
||||
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
|
||||
<p>{% blocktrans %}Please sign in with one of your existing
|
||||
third party accounts:{% endblocktrans %}</p>
|
||||
|
||||
<div class="socialaccount_ballot">
|
||||
<div class="socialaccount_ballot">
|
||||
|
||||
<ul class="socialaccount_providers">
|
||||
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
|
||||
</ul>
|
||||
|
||||
<div class="login-or">{% trans 'or' %}</div>
|
||||
<div class="login-or">
|
||||
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||
<p>{% blocktrans with site.name as site_name %}Or <a href="{{ signup_url }}">sign up</a>
|
||||
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
|
||||
{% else %}
|
||||
<p>{% blocktrans %}Or sign in below:{% endblocktrans %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "socialaccount/snippets/login_extra.html" %}
|
||||
{% include "socialaccount/snippets/login_extra.html" %}
|
||||
|
||||
{% else %}
|
||||
<p>{% blocktrans %}If you have not created an account yet, then please
|
||||
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
|
||||
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||
<p>{% blocktrans %}If you have not created an account yet, then please
|
||||
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form class="login" method="POST" action="{% url 'account_login' %}">
|
||||
|
|
|
@ -61,10 +61,12 @@
|
|||
<a class="nav-link" href="{% url 'account_logout' %}">{% trans "Sign Out" %}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||
<li class="nav-item">
|
||||
{# URL provided by django-allauth/account/urls.py #}
|
||||
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item">
|
||||
{# URL provided by django-allauth/account/urls.py #}
|
||||
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def allauth_settings(request):
|
||||
# return any necessary values
|
||||
return {
|
||||
'ACCOUNT_ALLOW_REGISTRATION': settings.ACCOUNT_ALLOW_REGISTRATION
|
||||
}
|
Loading…
Reference in New Issue
Block a user