diff --git a/seahub/profile/templates/profile/set_profile.html b/seahub/profile/templates/profile/set_profile.html index 2475b6b63c..b2e236fcf4 100644 --- a/seahub/profile/templates/profile/set_profile.html +++ b/seahub/profile/templates/profile/set_profile.html @@ -120,7 +120,11 @@

{% trans "Delete Account" %}

{% trans "This operation will not be reverted. Please think twice!" %}

- + + +
{% csrf_token %} + +
{% 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('

' + title + '

' + con + '

'); + $('#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 %} diff --git a/seahub/profile/views.py b/seahub/profile/views.py index 8faea4dbce..bd23c14e10 100644 --- a/seahub/profile/views.py +++ b/seahub/profile/views.py @@ -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':