2021-10-28 13:24:34 +00:00
|
|
|
{% extends theme('base.html') %}
|
2021-12-05 17:52:34 +00:00
|
|
|
{% import 'fomanticui.html' as sui %}
|
2020-10-20 09:44:45 +00:00
|
|
|
|
2020-11-01 10:33:56 +00:00
|
|
|
{% block script %}
|
2021-07-29 09:37:02 +00:00
|
|
|
<script src="/static/js/confirm.js"></script>
|
2021-12-08 17:06:50 +00:00
|
|
|
<script src="/static/js/profile.js"></script>
|
2020-11-01 10:33:56 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2021-12-05 18:45:27 +00:00
|
|
|
{% macro render_field(field, noindicator=false) %}
|
2021-12-06 11:17:18 +00:00
|
|
|
{% set lock_indicator = field.render_kw and ("readonly" in field.render_kw or "disabled" in field.render_kw) %}
|
2021-12-08 09:11:15 +00:00
|
|
|
{% if not edited_user %}
|
2021-12-08 17:06:50 +00:00
|
|
|
{{ sui.render_field(field, **kwargs) }}
|
2021-12-08 09:11:15 +00:00
|
|
|
{% elif edited_user.uid == user.uid or lock_indicator or noindicator %}
|
2021-12-08 17:06:50 +00:00
|
|
|
{{ sui.render_field(field, **kwargs) }}
|
2021-12-05 18:45:27 +00:00
|
|
|
{% elif field.name in edited_user.write %}
|
2022-01-07 14:19:05 +00:00
|
|
|
{{ sui.render_field(field, **kwargs) }}
|
2021-12-05 18:45:27 +00:00
|
|
|
{% elif field.name in edited_user.read %}
|
2021-12-08 17:06:50 +00:00
|
|
|
{{ sui.render_field(field, indicator_icon="eye", indicator_text=_("This user cannot edit this field"), **kwargs) }}
|
2021-12-05 18:45:27 +00:00
|
|
|
{% else %}
|
2021-12-08 17:06:50 +00:00
|
|
|
{{ sui.render_field(field, indicator_icon="eye slash", indicator_text=_("This user cannot see this field"), **kwargs) }}
|
2021-12-05 18:45:27 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
2020-10-20 09:44:45 +00:00
|
|
|
{% block content %}
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if self_deletion or (user.can_manage_users and edited_user) %}
|
2022-11-15 11:08:17 +00:00
|
|
|
<div id="modal-delete" class="ui basic modal">
|
2021-12-20 22:57:27 +00:00
|
|
|
<div class="ui icon header">
|
|
|
|
<i class="user minus icon"></i>
|
|
|
|
{% trans %}Account deletion{% endtrans %}
|
|
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
<p>
|
|
|
|
{% if user.uid != edited_user.uid %}
|
|
|
|
{{ _("Are you sure you want to delete this user? This action is unrevokable and all the data about this user will be removed.") }}
|
|
|
|
{% else %}
|
|
|
|
{{ _("Are you sure you want to delete your account? This action is unrevokable and all your data will be removed forever.") }}
|
|
|
|
{% endif %}
|
|
|
|
</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>
|
2020-10-20 09:44:45 +00:00
|
|
|
</div>
|
2021-12-20 22:57:27 +00:00
|
|
|
{% endif %}
|
2021-12-08 17:06:50 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
<div class="ui clearing segment">
|
|
|
|
<h2 class="ui center aligned header">
|
|
|
|
<div class="content">
|
|
|
|
{% 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 %}
|
2021-12-08 17:06:50 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
</div>
|
|
|
|
<div class="sub header">
|
|
|
|
{% 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 %}
|
|
|
|
</div>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
<form method="POST"
|
|
|
|
id="{{ form.__class__.__name__|lower }}"
|
|
|
|
action="{{ request.url }}"
|
|
|
|
role="form"
|
|
|
|
enctype="multipart/form-data"
|
|
|
|
class="ui form info{% if user.can_manage_users and edited_user and not edited_user.has_password() %} warning{% endif %} profile-form"
|
|
|
|
>
|
|
|
|
|
|
|
|
{#{ render_field(form.csrf_token) }#}
|
|
|
|
|
|
|
|
<h4 class="ui dividing header">{% trans %}Personal information{% endtrans %}</h4>
|
|
|
|
|
|
|
|
{% if "jpegPhoto" in form %}
|
|
|
|
<div class="ui grid">
|
|
|
|
<div class="three wide column">
|
|
|
|
{% block photo_field scoped %}
|
|
|
|
{{ render_field(form.jpegPhoto, display=false, class="photo-field") }}
|
|
|
|
{{ render_field(form.jpegPhoto_delete, display=false, class="photo-delete-button") }}
|
|
|
|
{% set photo = edited_user.jpegPhoto and edited_user.jpegPhoto[0] %}
|
|
|
|
<label
|
|
|
|
class="ui small bordered image photo-content"
|
|
|
|
for="{{ form.jpegPhoto.id }}"
|
|
|
|
title="{{ _("Click to upload a photo") }}"
|
|
|
|
{% if not photo %}style="display: none;"{% endif %}>
|
|
|
|
|
|
|
|
<a class="ui right corner label photo-delete-icon" title="{{ _("Delete the photo") }}">
|
|
|
|
<i class="times icon"></i>
|
|
|
|
</a>
|
|
|
|
<img src="{% if photo %}{{ url_for("account.photo", uid=edited_user.uid[0], field="jpegPhoto") }}{% endif %}" alt="User photo">
|
|
|
|
</label>
|
|
|
|
<label
|
|
|
|
class="ui centered photo-placeholder"
|
|
|
|
for="{{ form.jpegPhoto.id }}"
|
|
|
|
title="{{ _("Click to upload a photo") }}"
|
|
|
|
{% if photo %}style="display: none;"{% endif %}>
|
|
|
|
<i class="massive centered portrait icon"></i>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
<div class="thirteen wide column">
|
2020-11-26 14:29:14 +00:00
|
|
|
{% endif %}
|
2021-12-08 17:06:50 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
<div class="two fields">
|
|
|
|
{% if "givenName" in form %}
|
|
|
|
{% block given_name_field scoped %}{{ render_field(form.givenName) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-12-08 17:06:50 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "sn" in form %}
|
|
|
|
{% block sn_field scoped %}{{ render_field(form.sn) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-12-13 22:04:34 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
</div>
|
2021-12-13 22:04:34 +00:00
|
|
|
|
2021-12-22 10:06:13 +00:00
|
|
|
{% if "jpegPhoto" in form %}</div></div>{% endif %}
|
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "mail" in form %}
|
|
|
|
{% block mail_field scoped %}{{ render_field(form.mail) }}{% endblock %}
|
|
|
|
{% endif %}
|
2020-11-02 10:39:00 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "telephoneNumber" in form %}
|
|
|
|
{% block telephone_number_field scoped %}{{ render_field(form.telephoneNumber) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-01-13 08:55:07 +00:00
|
|
|
|
2022-07-07 12:35:17 +00:00
|
|
|
{% if "postalAddress" in form %}
|
|
|
|
{% block postal_address_field scoped %}{{ render_field(form.postalAddress) }}{% endblock %}
|
|
|
|
{% endif %}
|
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "employeeNumber" in form %}
|
|
|
|
{% block employee_number_field scoped %}{{ render_field(form.employeeNumber) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-12-13 22:04:34 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "labeledURI" in form %}
|
|
|
|
{% block labeled_uri_field scoped %}{{ render_field(form.labeledURI) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-01-22 17:26:53 +00:00
|
|
|
|
2022-11-20 21:12:18 +00:00
|
|
|
{% if "preferredLanguage" in form %}
|
|
|
|
{% block preferred_language_field scoped %}{{ render_field(form.preferredLanguage) }}{% endblock %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
<h4 class="ui dividing header">{% trans %}Account information{% endtrans %}</h4>
|
2021-01-22 17:26:53 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "uid" in form %}
|
|
|
|
{% block uid_field scoped %}{{ render_field(form.uid) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-12-01 11:19:28 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "groups" in form %}
|
|
|
|
{% block groups_field scoped %}{{ render_field(form.groups) }}{% endblock %}
|
|
|
|
{% endif %}
|
2021-01-22 17:26:53 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if "password1" in form %}
|
|
|
|
{% block password_field scoped %}
|
|
|
|
<div class="two fields">
|
|
|
|
{{ render_field(form.password1, noindicator=true) }}
|
|
|
|
{{ render_field(form.password2, noindicator=true) }}
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% endif %}
|
2021-12-01 11:19:28 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if user.can_manage_users %}
|
|
|
|
|
|
|
|
{% if not edited_user %}
|
|
|
|
|
|
|
|
<div class="ui message info">
|
|
|
|
<div class="header">
|
|
|
|
{% trans %}User password is not mandatory{% endtrans %}
|
|
|
|
</div>
|
|
|
|
{% if has_password %}
|
|
|
|
<p>{% trans %}The user password can be set:{% endtrans %}</p>
|
|
|
|
<ul class="ui list">
|
|
|
|
<li>{% trans %}by filling this form;{% endtrans %}</li>
|
|
|
|
<li>{% trans %}by sending the user a password initialization mail, after the account creation;{% endtrans %}</li>
|
|
|
|
<li>{% trans %}or simply waiting for the user to sign-in a first time, and then receive a password initialization mail.{% endtrans %}</li>
|
|
|
|
</ul>
|
|
|
|
{% else %}
|
|
|
|
<p>{% trans %}The user will not be able to authenticate unless the password is set{% endtrans %}</p>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% elif not edited_user.has_password() %}
|
|
|
|
|
2022-11-09 17:03:13 +00:00
|
|
|
<div class="ui message warning visible">
|
2022-04-05 15:16:09 +00:00
|
|
|
{% if has_smtp and edited_user.can_edit_self %}
|
2022-11-16 17:19:24 +00:00
|
|
|
<button type="submit" name="action" value="password-initialization-mail" class="ui right floated primary button">
|
|
|
|
{% trans %}Send email{% endtrans %}
|
|
|
|
</button>
|
2021-12-20 22:57:27 +00:00
|
|
|
{% endif %}
|
|
|
|
<div class="header">
|
|
|
|
{% trans %}This user does not have a password yet{% endtrans %}
|
|
|
|
</div>
|
2022-04-05 15:16:09 +00:00
|
|
|
{% if has_smtp and edited_user.can_edit_self %}
|
2021-12-20 22:57:27 +00:00
|
|
|
<p>{% trans %}You can solve this by:{% endtrans %}</p>
|
|
|
|
<ul class="ui list">
|
|
|
|
<li>{% trans %}setting a password using this form;{% endtrans %}</li>
|
|
|
|
<li>{% trans %}sending the user a password initialization mail, by clicking this button;{% endtrans %}</li>
|
|
|
|
<li>{% trans %}or simply waiting for the user to sign-in a first time, and then receive a password initialization mail.{% endtrans %}</li>
|
|
|
|
</ul>
|
|
|
|
{% else %}
|
|
|
|
<p>{% trans %}The user will not be able to authenticate unless the password is set{% endtrans %}</p>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
2022-04-05 15:16:09 +00:00
|
|
|
{% elif has_smtp and edited_user.uid != user.uid and edited_user.has_password() and edited_user.can_edit_self %}
|
2021-12-20 22:57:27 +00:00
|
|
|
|
|
|
|
<div class="ui message info">
|
|
|
|
<button type="submit" name="action" value="password-reset-mail" class="ui right floated button">
|
2022-11-16 17:19:24 +00:00
|
|
|
{% trans %}Send mail{% endtrans %}
|
2021-12-07 15:39:18 +00:00
|
|
|
</button>
|
2021-12-20 22:57:27 +00:00
|
|
|
<div class="header">
|
|
|
|
{% trans %}Password reset{% endtrans %}
|
|
|
|
</div>
|
|
|
|
<p>{% trans %}If the user has forgotten his password, you can send him a password reset email by clicking this button.{% endtrans %}</p>
|
|
|
|
</div>
|
2021-12-01 11:19:28 +00:00
|
|
|
|
|
|
|
{% endif %}
|
2021-01-22 17:26:53 +00:00
|
|
|
|
2020-11-26 14:29:14 +00:00
|
|
|
{% endif %}
|
2020-11-01 10:33:56 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
<div class="ui right aligned container">
|
|
|
|
<div class="ui stackable buttons">
|
|
|
|
{% if user.can_manage_users and edited_user or self_deletion %}
|
|
|
|
<button type="submit" class="ui right floated basic negative button confirm" name="action" value="delete" id="delete">
|
|
|
|
{% if user.uid != edited_user.uid %}
|
|
|
|
{{ _("Delete the user") }}
|
|
|
|
{% else %}
|
|
|
|
{{ _("Delete my account") }}
|
|
|
|
{% endif %}
|
|
|
|
</button>
|
2021-07-01 07:55:40 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if user.can_impersonate_users and edited_user and user.uid != edited_user.uid %}
|
|
|
|
<a href="{{ url_for('account.impersonate', username=edited_user.uid[0]) }}" class="ui right floated basic button" name="action" value="impersonate" id="impersonate">
|
|
|
|
{{ _("Impersonate") }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2021-07-01 07:55:40 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
{% if user.can_manage_users and not edited_user and has_smtp %}
|
|
|
|
<a href="{{ url_for('account.user_invitation') }}" class="ui right floated button" name="action" value="impersonate" id="impersonate">
|
|
|
|
{{ _("Invite a user") }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2021-12-01 11:19:28 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
<button type="submit" class="ui right floated primary button" name="action" value="edit" id="edit">
|
|
|
|
{{ _("Submit") }}
|
|
|
|
</button>
|
2021-07-01 07:55:40 +00:00
|
|
|
|
2021-12-20 22:57:27 +00:00
|
|
|
</div>
|
2021-07-01 07:55:40 +00:00
|
|
|
</div>
|
2021-12-20 22:57:27 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2020-10-20 09:44:45 +00:00
|
|
|
{% endblock %}
|