The ldap module should not be a mandatory requirement.

see #192
This commit is contained in:
Antoine Nguyen
2012-01-17 13:47:05 +01:00
parent 960714ca5a
commit cf91a3edc1
5 changed files with 248 additions and 254 deletions
+8 -1
View File
@@ -6,11 +6,16 @@ from django.conf import settings
from modoboa.lib import parameters, events
from modoboa.lib.sysutils import exec_cmd, exec_as_vuser
from modoboa.lib.emailutils import split_mailbox
from modoboa.lib.ldaputils import *
from modoboa.auth.lib import crypt_password
import os
import pwd
try:
from modoboa.lib.ldaputils import *
ldap_available = True
except ImportError:
ldap_available = False
class AdminError(Exception):
"""Custom exception
@@ -305,6 +310,8 @@ class Mailbox(DatesAware):
self.password = crypt_password(newvalue)
self.save()
return
if not ldap_available:
raise AdminError(_("Failed to update password: LDAP module not installed"))
ab = LDAPAuthBackend()
try: