feat(accounts): Simplify the template and disable signup
This commit is contained in:
parent
2817054e7e
commit
abc71eb52d
3 changed files with 14 additions and 50 deletions
|
@ -110,6 +110,10 @@ AUTHENTICATION_BACKENDS = [
|
|||
"allauth.account.auth_backends.AuthenticationBackend",
|
||||
]
|
||||
|
||||
ACCOUNT_ADAPTER = "shared.account.AccountAdapter"
|
||||
ACCOUNT_CHANGE_EMAIL = True
|
||||
ACCOUNT_EMAIL_NOTIFICATIONS = True
|
||||
|
||||
SOCIALACCOUNT_ONLY = True
|
||||
SOCIALACCOUNT_PROVIDERS = {
|
||||
"openid_connect": {
|
||||
|
|
10
src/shared/account.py
Normal file
10
src/shared/account.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from allauth.account.adapter import DefaultAccountAdapter
|
||||
|
||||
|
||||
class AccountAdapter(DefaultAccountAdapter):
|
||||
"""
|
||||
Overrides the Account Adapter.
|
||||
"""
|
||||
|
||||
def is_open_for_signup(self, request):
|
||||
return False
|
|
@ -16,56 +16,6 @@
|
|||
{% include "_hero.html" %}
|
||||
|
||||
<section class="section container">
|
||||
<nav class="level">
|
||||
{% if user.is_authenticated %}
|
||||
{% url 'account_email' as email_url %}
|
||||
{% if email_url %}
|
||||
<li class="level-item button is-light">
|
||||
<a href="{{ email_url }}">{% trans "Change Email" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% url 'account_change_password' as change_password_url %}
|
||||
{% if change_password_url %}
|
||||
<li class="level-item button is-light">
|
||||
<a href="{{ change_password_url }}">{% trans "Change Password" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% url 'mfa_index' as mfa_url %}
|
||||
{% if mfa_url %}
|
||||
<li class="level-item button is-light">
|
||||
<a href="{{ mfa_url }}">{% trans "Two-Factor Authentication" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% url 'usersessions_list' as usersessions_list_url %}
|
||||
{% if usersessions_list_url %}
|
||||
<li class="level-item button is-light">
|
||||
<a href="{{ usersessions_list_url }}">{% trans "Sessions" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% url 'account_logout' as logout_url %}
|
||||
{% if logout_url %}
|
||||
<li class="level-item button is-light">
|
||||
<a href="{{ logout_url }}">{% trans "Sign Out" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% url 'account_login' as login_url %}
|
||||
{% if login_url %}
|
||||
<li class="level-item button is-light has-text-weight-bold">
|
||||
<a href="{{ login_url }}">{% trans "Sign In" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% url 'account_signup' as signup_url %}
|
||||
{% if signup_url %}
|
||||
<li class="level-item button is-light has-text-weight-bold">
|
||||
<a href="{{ signup_url }}">{% trans "Sign Up" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="content">
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
|
|
Loading…
Reference in a new issue