[FEAT] Enable django-allauth for enhanced user management & federation

This commit is contained in:
2023-02-24 19:42:07 +00:00
parent 05ca7433f1
commit 86e18c399d
58 changed files with 1248 additions and 30 deletions

View File

@@ -0,0 +1,93 @@
{% extends "account/base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Account Details" %}{% endblock %}
{% block content %}
<h1 class="h1" id="head_banner">Account Details</h1>
<h2 class="h2" id="head_banner">{% trans "Email Addresses" %}</h2>
{% if user.emailaddress_set.all %}
<p class="email_settings_info">{% trans 'The following email addresses are associated with your account:' %}</p>
<form action="{% url 'account_email' %}" method="post">
{% csrf_token %}
{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
{{ emailaddress.email }}
{% if emailaddress.primary %}
<span class="primary">(primary email)</span>
{% endif %}
{% if not emailaddress.verified %}
<span class="unverified">(not verified)</span>
{% endif %}
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
</label>
</div>
{% endfor %}
<div>
<button class="btn btn-primary" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="btn btn-info" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="btn btn-danger" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>
</form>
{% else %}
<p class="email_settings_info"><strong>{% trans 'Warning:'%}</strong> {% trans "You do not have any email addresses set up. Please add an email address to receive notifications, reset your password, and perform other account-related actions." %}</p>
{% endif %}
<h3 class="h3" id="head_banner">{% trans "Add Email Address" %}</h3>
<form method="post" id="email_form" action="{% url 'account_email' %}">
{% csrf_token %}
{% load bootstrap4 %}
{% bootstrap_form form %}
<button class="btn btn-primary" name="action_add" type="submit">{% trans "Add Email" %}</button>
</form>
<h2 class="h2" id="head_banner">{% trans "Change Password" %}</h2>
<a class="btn btn-primary mb-4" href="{% url 'account_change_password' %}">{% trans "Change password" %}</a>
<h2 class="h2" id="head_banner">{% trans "Federated Login" %}</h2>
<p>You can connect third-party accounts to log into this site with them.</p>
<a class="btn btn-primary" href="{% url 'socialaccount_connections' %}">{% trans "Manage" %}</a>
{% endblock %}
{% block extra_body %}
<script type="text/javascript">
(function() {
var message = "{% trans 'Are you sure you want to remove the selected email address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock %}