2020-10-20 09:44:45 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
{% import 'fomanticui.j2' as sui %}
|
2020-10-31 17:22:24 +00:00
|
|
|
{% import 'flask.j2' as flask %}
|
2020-10-20 09:44:45 +00:00
|
|
|
|
2020-11-01 10:33:56 +00:00
|
|
|
{% block script %}
|
|
|
|
<script src="/static/js/profile.js"></script>
|
|
|
|
{% endblock %}
|
|
|
|
|
2020-10-20 09:44:45 +00:00
|
|
|
{% block content %}
|
2020-11-02 11:13:03 +00:00
|
|
|
{% if user.moderator and edited_user %}
|
2020-11-01 10:33:56 +00:00
|
|
|
<div class="ui basic modal">
|
|
|
|
<div class="ui icon header">
|
|
|
|
<i class="user minus icon"></i>
|
|
|
|
{% trans %}User deletion{% endtrans %}
|
|
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
<p>{{ _("Are you sure you want to delete this user? This action is unrevokable and all the data about this user will be removed.") }}</p>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<div class="ui inverted cancel button">{% trans %}Cancel{% endtrans %}</div>
|
|
|
|
<div class="ui inverted red approve button">{% trans %}Delete{% endtrans %}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-10-20 09:44:45 +00:00
|
|
|
<div class="ui clearing segment">
|
|
|
|
<h2 class="ui center aligned header">
|
|
|
|
<div class="content">
|
2020-11-01 10:33:56 +00:00
|
|
|
{% if not edited_user %}
|
|
|
|
{% trans %}User creation{% endtrans %}
|
|
|
|
{% elif user.uid == edited_user.uid %}
|
|
|
|
{% trans %}My profile{% endtrans %}
|
|
|
|
{% else %}
|
|
|
|
{% trans %}User profile edition{% endtrans %}
|
|
|
|
{% endif %}
|
|
|
|
|
2020-10-20 09:44:45 +00:00
|
|
|
</div>
|
|
|
|
<div class="sub header">
|
2020-11-01 10:33:56 +00:00
|
|
|
{% if not edited_user %}
|
|
|
|
{% trans %}Create a new user account{% endtrans %}
|
|
|
|
{% elif user.uid == edited_user.uid %}
|
|
|
|
{% trans %}Edit your personal informations{% endtrans %}
|
|
|
|
{% else %}
|
|
|
|
{% trans %}Edit informations about an user{% endtrans %}
|
|
|
|
{% endif %}
|
2020-10-20 09:44:45 +00:00
|
|
|
</div>
|
|
|
|
</h2>
|
|
|
|
|
2020-11-25 15:58:01 +00:00
|
|
|
{{ flask.messages() }}
|
|
|
|
|
2020-11-01 10:33:56 +00:00
|
|
|
<form method="POST"
|
|
|
|
id="{{ form.__class__.__name__|lower }}"
|
|
|
|
action="{{ request.url }}"
|
|
|
|
role="form"
|
|
|
|
enctype="multipart/form-data"
|
|
|
|
class="ui form"
|
|
|
|
>
|
|
|
|
|
2020-11-26 14:29:14 +00:00
|
|
|
{#{ sui.render_field(form.csrf_token) }#}
|
2020-11-02 10:39:00 +00:00
|
|
|
|
|
|
|
<h4 class="ui dividing header">{% trans %}Personal information{% endtrans %}</h4>
|
|
|
|
<div class="two fields">
|
2020-11-26 14:29:14 +00:00
|
|
|
{% if "givenName" in form %}
|
|
|
|
{{ sui.render_field(form.givenName) }}
|
|
|
|
{% endif %}
|
|
|
|
{% if "sn" in form %}
|
|
|
|
{{ sui.render_field(form.sn) }}
|
|
|
|
{% endif %}
|
2020-11-02 10:39:00 +00:00
|
|
|
</div>
|
2020-11-26 14:29:14 +00:00
|
|
|
{% if "mail" in form %}
|
|
|
|
{{ sui.render_field(form.mail) }}
|
|
|
|
{% endif %}
|
|
|
|
{% if "telephoneNumber" in form %}
|
|
|
|
{{ sui.render_field(form.telephoneNumber) }}
|
|
|
|
{% endif %}
|
|
|
|
{% if "employeeNumber" in form %}
|
|
|
|
{{ sui.render_field(form.employeeNumber) }}
|
|
|
|
{% endif %}
|
2020-11-02 10:39:00 +00:00
|
|
|
|
|
|
|
<h4 class="ui dividing header">{% trans %}Account information{% endtrans %}</h4>
|
2020-11-26 14:29:14 +00:00
|
|
|
{% if "uid" in form %}
|
|
|
|
{{ sui.render_field(form.uid) }}
|
|
|
|
{% endif %}
|
2020-11-02 10:39:00 +00:00
|
|
|
<div class="two fields">
|
2020-11-26 14:29:14 +00:00
|
|
|
{% if "password1" in form %}
|
|
|
|
{{ sui.render_field(form.password1) }}
|
|
|
|
{{ sui.render_field(form.password2) }}
|
|
|
|
{% endif %}
|
2020-11-02 10:39:00 +00:00
|
|
|
</div>
|
2020-11-01 10:33:56 +00:00
|
|
|
|
|
|
|
<button type="submit" class="ui right floated primary button" name="action" value="edit" id="edit">
|
|
|
|
{{ _("Send") }}
|
|
|
|
</button>
|
2020-12-27 17:21:31 +00:00
|
|
|
{% if user.admin and edited_user and user.uid != edited_user.uid %}
|
2020-12-11 10:52:37 +00:00
|
|
|
<a href="{{ url_for('canaille.account.impersonate', username=edited_user.uid[0]) }}" class="ui right floated basic button" name="action" value="impersonate" id="impersonate">
|
|
|
|
{{ _("Impersonate") }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2020-11-02 11:13:03 +00:00
|
|
|
{% if user.moderator and edited_user %}
|
2020-11-25 15:06:28 +00:00
|
|
|
<button type="submit" class="ui right floated basic negative button confirm" name="action" value="delete" id="delete">
|
2020-11-01 10:33:56 +00:00
|
|
|
{{ _("Delete the user") }}
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
2020-10-20 09:44:45 +00:00
|
|
|
</div>
|
|
|
|
{% endblock %}
|