mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 17:26:26 +01:00
config: add DISABLE_ACCOUNT_DELETION
This commit is contained in:
parent
bfb6a127f0
commit
7ae8a1939a
@ -14,6 +14,9 @@ MAX_ONLINE_QUERIES=3
|
|||||||
# Disable registration of new users via /auth/register (they can still be added by root)
|
# Disable registration of new users via /auth/register (they can still be added by root)
|
||||||
DISABLE_REGISTER=False
|
DISABLE_REGISTER=False
|
||||||
|
|
||||||
|
# Disable account deletion for users (still possible for admins)
|
||||||
|
DISABLE_ACCOUNT_DELETION=False
|
||||||
|
|
||||||
# Front URL of the application (for QRCodes generation)
|
# Front URL of the application (for QRCodes generation)
|
||||||
BASE_URL="http://localhost:5000"
|
BASE_URL="http://localhost:5000"
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ def user_inspect(user_id):
|
|||||||
"settings/index.html",
|
"settings/index.html",
|
||||||
skip_old_password=True,
|
skip_old_password=True,
|
||||||
inspected_user=inspected_user,
|
inspected_user=inspected_user,
|
||||||
user=current_user
|
user=current_user,
|
||||||
|
deletion_allowed=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ def index():
|
|||||||
return render_template(
|
return render_template(
|
||||||
"settings/index.html",
|
"settings/index.html",
|
||||||
inspected_user=user,
|
inspected_user=user,
|
||||||
user=user
|
user=user,
|
||||||
|
deletion_allowed=not current_app.config["DISABLE_ACCOUNT_DELETION"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +49,10 @@ def delete_account():
|
|||||||
if cur_user.id != mod_user.id:
|
if cur_user.id != mod_user.id:
|
||||||
flash(_("Missing rights."))
|
flash(_("Missing rights."))
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
|
|
||||||
|
if current_app.config["DISABLE_ACCOUNT_DELETION"]:
|
||||||
|
flash(_("You are not allowed to delete your account."))
|
||||||
|
return redirect(request.referrer)
|
||||||
else:
|
else:
|
||||||
log_data = [mod_user.username, mod_user.id, cur_user.username]
|
log_data = [mod_user.username, mod_user.id, cur_user.username]
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@
|
|||||||
<input type="hidden" id="user_id" name="user_id" value="{{ inspected_user.id }}">
|
<input type="hidden" id="user_id" name="user_id" value="{{ inspected_user.id }}">
|
||||||
<input type="Submit" value="{{ _('confirm') }}">
|
<input type="Submit" value="{{ _('confirm') }}">
|
||||||
</form>
|
</form>
|
||||||
|
{% if deletion_allowed %}
|
||||||
<h3>{{ _("Delete account") }}</h3>
|
<h3>{{ _("Delete account") }}</h3>
|
||||||
<a href="#delete-account"><button class="red-confirm">{{ _("Delete account") }}</button></a>
|
<a href="#delete-account"><button class="red-confirm">{{ _("Delete account") }}</button></a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user