diff --git a/CHANGES.rst b/CHANGES.rst index 23f3c99b..e542e7fb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,6 +20,7 @@ Added - Improved consents page. :issue:`27` - Admin user page. :issue:`8` - Project logo. :pr:`29` +- User account self-deletion can be enabled in the configuration with `SELF_DELETION`. :issue:`35` - Admins can impersonate users. :issue:`39` - Forgotten page UX improvement. :pr:`43` - Admins can remove clients. :pr:`45` diff --git a/canaille/account.py b/canaille/account.py index 194e7367..12c99700 100644 --- a/canaille/account.py +++ b/canaille/account.py @@ -190,7 +190,11 @@ def profile_creation(user): ) return render_template( - "profile.html", form=form, menuitem="users", edited_user=None + "profile.html", + form=form, + menuitem="users", + edited_user=None, + self_deletion=False, ) @@ -256,7 +260,11 @@ def profile_edit(user, username): user.save() return render_template( - "profile.html", form=form, menuitem=menuitem, edited_user=user + "profile.html", + form=form, + menuitem=menuitem, + edited_user=user, + self_deletion=current_app.config.get("SELF_DELETION", True), ) diff --git a/canaille/templates/profile.html b/canaille/templates/profile.html index e4c84756..08eebfff 100644 --- a/canaille/templates/profile.html +++ b/canaille/templates/profile.html @@ -7,14 +7,20 @@ {% endblock %} {% block content %} -{% if user.moderator and edited_user %} +{% if self_deletion or (user.moderator and edited_user) %}