New events.

This commit is contained in:
Antoine Nguyen
2013-05-06 12:48:59 +02:00
parent 39c3d8c107
commit 019565bbca
3 changed files with 13 additions and 10 deletions
+9 -9
View File
@@ -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)
+2 -1
View File
@@ -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",
+2
View File
@@ -33,6 +33,8 @@ events = [
"AccountCreated",
"AccountModified",
"AccountDeleted",
"PasswordUpdated",
"ExtraAccountActions",
"PasswordChange",