diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py index 8690b7ab5..e9dbf29a7 100644 --- a/modoboa/admin/models.py +++ b/modoboa/admin/models.py @@ -155,16 +155,16 @@ class User(AbstractBaseUser, PermissionsMixin): """ if parameters.get_admin("AUTHENTICATION_TYPE") == "local": self.password = self._crypt_password(raw_value) - return + else: + if not ldap_available: + raise AdminError(_("Failed to update password: LDAP module not installed")) - if not ldap_available: - raise AdminError(_("Failed to update password: LDAP module not installed")) - - ab = LDAPAuthBackend() - try: - ab.update_user_password(self.username, curvalue, raw_value) - except LDAPException, e: - raise AdminError(_("Failed to update password: %s" % str(e))) + ab = LDAPAuthBackend() + try: + ab.update_user_password(self.username, curvalue, raw_value) + except LDAPException, e: + raise AdminError(_("Failed to update password: %s" % str(e))) + events.raiseEvent("PasswordUpdated", self, raw_value) def check_password(self, raw_value): m = self.password_expr.match(self.password) diff --git a/modoboa/admin/templatetags/admin_extras.py b/modoboa/admin/templatetags/admin_extras.py index 3474f5e20..78219cbb3 100644 --- a/modoboa/admin/templatetags/admin_extras.py +++ b/modoboa/admin/templatetags/admin_extras.py @@ -181,7 +181,8 @@ def identity_actions(user, ident): name = ident.__class__.__name__ objid = ident.id if name == "User": - actions = [ + actions = events.raiseQueryEvent("ExtraAccountActions", ident) + actions += [ {"name" : "delaccount", "url" : reverse("modoboa.admin.views.delaccount") + "?selection=%s" % objid, "img" : "icon-trash", diff --git a/modoboa/lib/events.py b/modoboa/lib/events.py index 51d82793d..e3dc37fd4 100644 --- a/modoboa/lib/events.py +++ b/modoboa/lib/events.py @@ -33,6 +33,8 @@ events = [ "AccountCreated", "AccountModified", "AccountDeleted", + "PasswordUpdated", + "ExtraAccountActions", "PasswordChange",