mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
[profile] send POST request when delete account
This commit is contained in:
@@ -120,7 +120,11 @@
|
||||
<div class="setting-item" id="del-account">
|
||||
<h3>{% trans "Delete Account" %}</h3>
|
||||
<p>{% trans "This operation will not be reverted. Please think twice!" %}</p>
|
||||
<button id="account-delete-btn" data-url="{% url 'delete_user_account' %}">{% trans "Delete" %}</button>
|
||||
<button type="button" id="account-delete-btn">{% trans "Delete" %}</button>
|
||||
|
||||
<form id="account-delete-form" class="hide" method="post" action="{% url 'delete_user_account' %}">{% csrf_token %}
|
||||
<input type="submit" value="{% trans "Delete" %}" class="submit" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form id="default-lib-form" action="{% url 'default_repo' %}" method="post" class="file-choose-form hide">{% csrf_token %}
|
||||
@@ -144,11 +148,21 @@ $('#user-avatar-form').css({'left':cur_avatar.position().left + cur_avatar.outer
|
||||
|
||||
$('#user-basic-info .submit').css({'margin-left': $('#user-basic-info label').outerWidth(true)});
|
||||
changeAvatar($('#user-avatar-chg-btn'), $('#user-avatar-input'), $('#user-avatar-form'));
|
||||
addConfirmTo($('#account-delete-btn'), {
|
||||
'title' : "{% trans "Delete Account" %}",
|
||||
'con' : "{% trans "Really want to delete your account?" %}"
|
||||
|
||||
$('#account-delete-btn').click(function () {
|
||||
var title = "{% trans "Delete Account" %}",
|
||||
con = "{% trans "Really want to delete your account?" %}";
|
||||
|
||||
$('#confirm-con').html('<h3>' + title + '</h3><p>' + con + '</p>');
|
||||
$('#confirm-popup').modal({appendTo:'#main'});
|
||||
$('#simplemodal-container').css({'height':'auto'});
|
||||
|
||||
$('#confirm-yes').click(function() {
|
||||
$('#account-delete-form').submit();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
{% if user.permissions.can_add_repo %}
|
||||
var all_repos = [];
|
||||
{% for a_repo in owned_repos %}
|
||||
|
@@ -143,6 +143,9 @@ def get_user_profile(request, user):
|
||||
|
||||
@login_required
|
||||
def delete_user_account(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
username = request.user.username
|
||||
|
||||
if username == 'demo@seafile.com':
|
||||
|
Reference in New Issue
Block a user