ERPNext version
OS: Centos7.5
Python: 3.6
Bench: 4.1.0
Frappe: 12.x.x-develop
erpnext: 12.x.x-develop
Issue:
After setup the Active Directory in integration->LDAP. AD user cannot login with message " invalid username or password"
We saw following error message in logs/frappe.log file.
[ERROR] 2019-09-03 18:02:22,388 | /opt/frappe-bench/apps/frappe/frappe/utils/error.py:
Could not take error snapshot: startswith first arg must be str or a tuple of str, not bytes
Traceback (most recent call last):
File “/opt/frappe-bench/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/opt/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/opt/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/opt/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/opt/frappe-bench/apps/frappe/frappe/integrations/doctype/ldap_settings/ldap_settings.py”, line 207, in login
user = ldap.authenticate(frappe.as_unicode(args.usr), frappe.as_unicode(args.pwd))
File “/opt/frappe-bench/apps/frappe/frappe/integrations/doctype/ldap_settings/ldap_settings.py”, line 169, in authenticate
return self.create_or_update_user(self.convert_ldap_entry_to_dict(user), groups=groups)
File “/opt/frappe-bench/apps/frappe/frappe/integrations/doctype/ldap_settings/ldap_settings.py”, line 119, in create_or_update_user
user.insert(ignore_permissions=True)
File “/opt/frappe-bench/apps/frappe/frappe/model/document.py”, line 229, in insert
self._validate()
File “/opt/frappe-bench/apps/frappe/frappe/model/document.py”, line 461, in _validate
self._validate_length()
File “/opt/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 578, in _validate_length
if len(cstr(value)) > max_length:
File “/opt/frappe-bench/apps/frappe/frappe/utils/data.py”, line 342, in cstr
return frappe.as_unicode(s, encoding)
File “/opt/frappe-bench/apps/frappe/frappe/init.py”, line 80, in as_unicode
return text_type(text, encoding)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x89 in position 0: invalid start byte
Analysis
Sounds like it is related AD attribute thumbnailPhoto, we have users Photos stored in thumbnailPhoto, if we remove the Photo map in LDAP settings, the issue gone.
So, Please advise how can we fix it.
Thanks.