Show More
@@ -40,7 +40,8 b' from rhodecode import __platform__, is_w' | |||
|
40 | 40 | from rhodecode.model.meta import Session |
|
41 | 41 | |
|
42 | 42 | from rhodecode.lib.utils2 import str2bool, safe_unicode |
|
43 | from rhodecode.lib.exceptions import LdapPasswordError, LdapUsernameError | |
|
43 | from rhodecode.lib.exceptions import LdapPasswordError, LdapUsernameError,\ | |
|
44 | LdapImportError | |
|
44 | 45 | from rhodecode.lib.utils import get_repo_slug, get_repos_group_slug |
|
45 | 46 | from rhodecode.lib.auth_ldap import AuthLdap |
|
46 | 47 | |
@@ -241,7 +242,7 b' def authenticate(username, password):' | |||
|
241 | 242 | |
|
242 | 243 | Session().commit() |
|
243 | 244 | return True |
|
244 | except (LdapUsernameError, LdapPasswordError,): | |
|
245 | except (LdapUsernameError, LdapPasswordError, LdapImportError): | |
|
245 | 246 | pass |
|
246 | 247 | except (Exception,): |
|
247 | 248 | log.error(traceback.format_exc()) |
@@ -26,7 +26,7 b'' | |||
|
26 | 26 | import logging |
|
27 | 27 | |
|
28 | 28 | from rhodecode.lib.exceptions import LdapConnectionError, LdapUsernameError, \ |
|
29 | LdapPasswordError | |
|
29 | LdapPasswordError, LdapImportError | |
|
30 | 30 | from rhodecode.lib.utils2 import safe_str |
|
31 | 31 | |
|
32 | 32 | log = logging.getLogger(__name__) |
@@ -36,7 +36,7 b' try:' | |||
|
36 | 36 | import ldap |
|
37 | 37 | except ImportError: |
|
38 | 38 | # means that python-ldap is not installed |
|
39 | pass | |
|
39 | ldap = None | |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | class AuthLdap(object): |
@@ -45,6 +45,9 b' class AuthLdap(object):' | |||
|
45 | 45 | tls_kind='PLAIN', tls_reqcert='DEMAND', ldap_version=3, |
|
46 | 46 | ldap_filter='(&(objectClass=user)(!(objectClass=computer)))', |
|
47 | 47 | search_scope='SUBTREE', attr_login='uid'): |
|
48 | if ldap is None: | |
|
49 | raise LdapImportError | |
|
50 | ||
|
48 | 51 | self.ldap_version = ldap_version |
|
49 | 52 | ldap_server_type = 'ldap' |
|
50 | 53 |
General Comments 0
You need to be logged in to leave comments.
Login now