Prevent a user to disable its own account.

fix #361
This commit is contained in:
Antoine Nguyen
2013-01-19 19:10:27 +01:00
parent c11d2c9f0d
commit dd720c39d7
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -453,6 +453,8 @@ class AccountFormGeneral(forms.ModelForm):
def save(self, commit=True):
account = super(AccountFormGeneral, self).save(commit=False)
if self.user == account and not self.cleaned_data["is_active"]:
raise AdminError(_("You can't disable your own account"))
if commit:
if self.cleaned_data["password1"] != "":
account.set_password(self.cleaned_data["password1"])
+3 -3
View File
@@ -124,7 +124,7 @@ Domains.prototype = {
$(".submit").one('click', $.proxy(function(e) {
simple_ajax_form_post(e, {
formid: "domform",
error_cb: this.domainform_cb,
error_cb: $.proxy(this.domainform_cb, this),
reload_on_success: false,
success_cb: $.proxy(this.reload_listing, this)
});
@@ -258,7 +258,7 @@ Identities.prototype = {
$('.submit').one('click', $.proxy(function(e) {
simple_ajax_form_post(e, {
formid: "accountform",
error_cb: this.editaccount_cb,
error_cb: $.proxy(this.editaccount_cb, this),
reload_on_success: false,
success_cb: $.proxy(this.reload_listing, this)
});
@@ -277,7 +277,7 @@ Identities.prototype = {
$(".submit").one('click', $.proxy(function(e) {
simple_ajax_form_post(e, {
formid: "aliasform",
error_cb: this.aliasform_cb,
error_cb: $.proxy(this.aliasform_cb, this),
reload_on_success: false,
success_cb: $.proxy(this.reload_listing, this)
});