From 3b20e4985bf38c36fd88e135c633867dcbb4749e Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Tue, 29 Jan 2019 18:14:54 -0500 Subject: [PATCH] Hides 'sign up' elements when ACCOUNT_ALLOW_REGISTRATION is disabled --- CONTRIBUTORS.rst | 2 ++ .../config/settings/base.py | 1 + .../templates/account/login.html | 32 ++++++++++++------- .../templates/base.html | 2 ++ .../users/context_processors.py | 8 +++++ 5 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/context_processors.py diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index e3569e78e..d0b76ea20 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -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 diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 950b9ed7f..d22d09c0b 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -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', ], }, }, diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/login.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/login.html index a71932225..2ecbacbfb 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/login.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/account/login.html @@ -13,25 +13,33 @@ {% get_providers as socialaccount_providers %} {% if socialaccount_providers %} -

{% blocktrans with site.name as site_name %}Please sign in with one -of your existing third party accounts. Or, sign up -for a {{ site_name }} account and sign in below:{% endblocktrans %}

+

{% blocktrans %}Please sign in with one of your existing + third party accounts:{% endblocktrans %}

-
+
-
    - {% include "socialaccount/snippets/provider_list.html" with process="login" %} -
+
    + {% include "socialaccount/snippets/provider_list.html" with process="login" %} +
- + -
+
-{% include "socialaccount/snippets/login_extra.html" %} + {% include "socialaccount/snippets/login_extra.html" %} {% else %} -

{% blocktrans %}If you have not created an account yet, then please -sign up first.{% endblocktrans %}

+ {% if ACCOUNT_ALLOW_REGISTRATION %} +

{% blocktrans %}If you have not created an account yet, then please + sign up first.{% endblocktrans %}

+ {% endif %} {% endif %}
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html index 4470e955a..be99a0c31 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/base.html @@ -61,10 +61,12 @@ {% trans "Sign Out" %} {% else %} + {% if ACCOUNT_ALLOW_REGISTRATION %} + {% endif %}