haikal/templates/account/email.html
2025-05-15 19:29:22 +03:00

91 lines
4.8 KiB
HTML

{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load allauth i18n static %}
{% block head_title %}
{% trans "Email Addresses" %}
{% endblock head_title %}
{% block content %}
<div class="row ">
<div class="row flex-center min-vh-50">
<div class="col-sm-10 col-md-8 col-lg-5 col-xl-5 col-xxl-3">
<a class="d-flex flex-center text-decoration-none mb-4" href="{% url 'home' %}">
<div class="d-flex align-items-center fw-bolder fs-3 d-inline-block">
<div class="d-flex align-items-center fw-bolder fs-3 d-inline-block">
<img class="d-dark-none" src="{% static 'images/logos/logo-d.png' %}" alt="{% trans 'home' %}" width="58" />
<img class="d-light-none" src="{% static 'images/logos/logo.png' %}" alt="{% trans 'home' %}" width="58" />
</div>
</div>
</a>
<div class="text-center">
<h3 class="mb-4">{% trans "Email Addresses" %}</h3>
</div>
{% if emailaddresses %}
<p>
{% trans 'The following email addresses are associated with your account:' %}
</p>
{% url 'account_email' as email_url %}
<form action="{{ email_url }}" method="POST" class="form email list">
{% csrf_token %}
<div class="fs-9 fw-bold form-group mb-3 list-group">
{% for radio in emailaddress_radios %}
{% with emailaddress=radio.emailaddress %}
<label for="{{ radio.id }}">
<input type="radio" name="email" checked="{{ radio.checked }}" value="{{ emailaddress.email }}" id="{{ radio.id }}" class="form-check-input mb-3" />
{{ emailaddress.email }}
{% if emailaddress.verified %}
<span class="badge badge-phoenix badge-phoenix-success verified">{% translate "Verified" %}</span>
{% else %}
<span class="badge badge-phoenix badge-phoenix-warning unverified">{% translate "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}
<span class="badge badge-phoenix badge-phoenix-primary email">{% translate "Primary" %}</span>
{% endif %}
{% endwith %}
</label>
{% endfor %}
</div>
<div class="mt-2 mb-6">
<button type="submit" name="action_primary" class="btn btn-sm btn-primary">{% trans 'Make Primary' %}</button>
<button type="submit" name="action_send" class="btn btn-sm btn-secondary">{% trans 'Re-send Verification' %}</button>
<button type="submit" name="action_remove" class="btn btn-sm btn-danger delete">{% trans 'Remove' %}</button>
</div>
</form>
{% else %}
{% include "account/snippets/warn_no_email.html" %}
{% endif %}
{% if can_add_email %}
<p class="fs-8 fw-bold text-start">
{% trans "Add Email Address" %}
</p>
{% url 'account_email' as action_url %}
<form action="{{ action_url }}" method="POST" class="form email add">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-sn btn-success w-100" type="submit" name="action_add">
{% trans "Add Email" %}
</button>
</form>
{% endif %}
<script>
(function() {
var message = "{% trans 'Do you really 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>
</div>
</div>
</div>
{% endblock content %}