Customize account views
This commit is contained in:
parent
a65327f309
commit
3130913191
2 changed files with 145 additions and 0 deletions
79
photo21/templates/account/email.html
Normal file
79
photo21/templates/account/email.html
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
{% comment %}
|
||||||
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
{% endcomment %}
|
||||||
|
{% load i18n crispy_forms_tags %}
|
||||||
|
{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{% trans "Account" %}</h1>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header pb-0 border-bottom-0">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="{% url 'account_email' %}">{% trans "E-mail Addresses" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'socialaccount_connections' %}">{% trans "Social connections" %}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
{% if user.emailaddress_set.all %}
|
||||||
|
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
|
||||||
|
|
||||||
|
<form action="{% url 'account_email' %}" class="email_list" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<fieldset class="blockLabels">
|
||||||
|
{% for emailaddress in user.emailaddress_set.all %}
|
||||||
|
<div class="ctrlHolder">
|
||||||
|
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%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}}"/>
|
||||||
|
{{ emailaddress.email }}
|
||||||
|
{% if emailaddress.verified %}
|
||||||
|
<span class="badge bg-success">{% trans "Verified" %}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="badge bg-danger">{% trans "Unverified" %}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if emailaddress.primary %}<span class="badge bg-secondary">{% trans "Primary" %}</span>{% endif %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="mt-2 mb-4">
|
||||||
|
<button class="btn btn-sm btn-secondary" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
|
||||||
|
<button class="btn btn-sm btn-secondary" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
|
||||||
|
<button class="btn btn-sm btn-danger" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if can_add_email %}
|
||||||
|
<h2>{% trans "Add E-mail Address" %}</h2>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_email' %}" class="add_email">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<button name="action_add" type="submit" class="btn btn-success mt-2">{% trans "Add E-mail" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
|
||||||
|
var actions = document.getElementsByName('action_remove');
|
||||||
|
if (actions.length) {
|
||||||
|
actions[0].addEventListener("click", function(e) {
|
||||||
|
if (! confirm(message)) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
66
photo21/templates/socialaccount/connections.html
Normal file
66
photo21/templates/socialaccount/connections.html
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
{% extends "socialaccount/base.html" %}
|
||||||
|
{% comment %}
|
||||||
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
{% endcomment %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% block head_title %}{% trans "Account Connections" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{% trans "Account" %}</h1>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header pb-0 border-bottom-0">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'account_email' %}">{% trans "E-mail Addresses" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="{% url 'socialaccount_connections' %}">{% trans "Social connections" %}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
{% if form.accounts %}
|
||||||
|
<p>{% blocktrans %}You can sign in to your account using any of the following third party accounts:{% endblocktrans %}</p>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'socialaccount_connections' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<fieldset>
|
||||||
|
{% if form.non_field_errors %}
|
||||||
|
<div id="errorMsg">{{ form.non_field_errors }}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for base_account in form.accounts %}
|
||||||
|
{% with base_account.get_provider_account as account %}
|
||||||
|
<div>
|
||||||
|
<label for="id_account_{{ base_account.id }}">
|
||||||
|
<input id="id_account_{{ base_account.id }}" type="radio" name="account" value="{{ base_account.id }}"/>
|
||||||
|
<span class="socialaccount_provider {{ base_account.provider }} {{ account.get_brand.id }}">{{account.get_brand.name}}</span>
|
||||||
|
{{ account }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{% endwith %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit">{% trans 'Remove' %}</button>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<p>{% trans 'You currently have no social network accounts connected to this account.' %}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2>{% trans 'Add a 3rd Party Account' %}</h2>
|
||||||
|
|
||||||
|
<ul class="socialaccount_providers">
|
||||||
|
{% include "socialaccount/snippets/provider_list.html" with process="connect" %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% include "socialaccount/snippets/login_extra.html" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue