Prevent moderators and admins from being deleted

This commit is contained in:
rubenwardy 2021-01-01 16:53:14 +00:00
parent e709fc9ce3
commit 12bcdf2d47

@ -214,6 +214,10 @@ def delete(username):
if not user: if not user:
abort(404) abort(404)
if user.rank.atLeast(UserRank.MODERATOR):
flash("Users with moderator rank or above cannot be deleted", "danger")
return redirect(url_for("users.account", username=username))
if request.method == "GET": if request.method == "GET":
return render_template("users/delete.html", user=user, can_delete=user.can_delete()) return render_template("users/delete.html", user=user, can_delete=user.can_delete())