mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 14:02:24 +01:00
Add remove profile picture button
This commit is contained in:
parent
9cb4d13d71
commit
37bff46f33
@ -259,6 +259,18 @@ def user_check_forums(username):
|
||||
return redirect(url_for("tasks.check", id=task.id, r=next_url))
|
||||
|
||||
|
||||
@bp.route("/users/<username>/remove-profile-pic/", methods=["POST"])
|
||||
@login_required
|
||||
def user_remove_profile_pic(username):
|
||||
user = User.query.filter_by(username=username).one_or_404()
|
||||
if current_user != user and not current_user.rank.at_least(UserRank.MODERATOR):
|
||||
abort(403)
|
||||
|
||||
user.profile_pic = None
|
||||
db.session.commit()
|
||||
return redirect(url_for("users.profile_edit", username=username))
|
||||
|
||||
|
||||
@bp.route("/user/stats/")
|
||||
@login_required
|
||||
def statistics_redirect():
|
||||
|
@ -22,18 +22,22 @@
|
||||
</div>
|
||||
<div class="col">
|
||||
{% if user.forums_username %}
|
||||
<form method="post" action="{{ url_for('users.user_check_forums', username=user.username) }}" class="" style="display:inline-block;">
|
||||
<form method="post" action="{{ url_for('users.user_check_forums', username=user.username) }}" class="me-2" style="display:inline-block;">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="btn btn-primary" value="{{ _('Import from forums') }}" />
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if user.profile_pic %}
|
||||
<form method="post" action="{{ url_for('users.user_remove_profile_pic', username=user.username) }}" class="me-2" style="display:inline-block;">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="btn btn-secondary" value="{{ _('Remove profile picture') }}" />
|
||||
</form>
|
||||
{% elif user.email %}
|
||||
<a class="btn btn-primary" href="https://en.gravatar.com/">
|
||||
Gravatar
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="btn btn-primary disabled"
|
||||
<a class="btn btn-secondary disabled"
|
||||
data-toggle="tooltip" data-placement="bottom"
|
||||
title="Please add an email address to use Gravatar"
|
||||
style="pointer-events: all;">
|
||||
|
Loading…
Reference in New Issue
Block a user