The following error occurs with unicode in username or in password fields.
Since most LDAP systems aren't going to allow unicode usernames, I think its best to catch this situation ahead of time and provide a relevant error message, so the user can fix their input. Note that the unicode char may even be a hidden left-to-right marker for example, so an explicit message about unicode or non-ascii may be helpful.
For password, we should handle it. (The password change form lets you change it to unicode successfully)
File '/home/dbrondsema/dbrondsema-1019/forge/Allura/allura/lib/plugin.py', line 578 in _validate_password con = ldap_conn(ldap_user, password) File '/home/dbrondsema/dbrondsema-1019/forge/Allura/allura/lib/plugin.py', line 427 in ldap_conn cred or config['auth.ldap.admin_password']) File '/var/local/env-allura/lib/python2.7/site-packages/TimerMiddleware-0.4.4-py2.7.egg/timermiddleware/__init__.py', line 117 in wrapper return self.run_and_log(func, inst, *args, **kwargs) File '/var/local/env-allura/lib/python2.7/site-packages/TimerMiddleware-0.4.4-py2.7.egg/timermiddleware/__init__.py', line 126 in run_and_log return func(*args, **kwargs) File '/var/local/env-allura/lib/python2.7/site-packages/python_ldap-2.4.14-py2.7-linux-x86_64.egg/ldap/ldapobject.py', line 222 in bind_s msgid = self.bind(who,cred,method) File '/var/local/env-allura/lib/python2.7/site-packages/python_ldap-2.4.14-py2.7-linux-x86_64.egg/ldap/ldapobject.py', line 216 in bind return self.simple_bind(who,cred) File '/var/local/env-allura/lib/python2.7/site-packages/python_ldap-2.4.14-py2.7-linux-x86_64.egg/ldap/ldapobject.py', line 201 in simple_bind return self._ldap_call(self._l.simple_bind,who,cred,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls)) File '/var/local/env-allura/lib/python2.7/site-packages/python_ldap-2.4.14-py2.7-linux-x86_64.egg/ldap/ldapobject.py', line 99 in _ldap_call result = func(*args,**kwargs) UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-6: ordinal not in range(128)
Diff:
I have a fix related to the error handling that happens here: to show a proper error page instead of a weird 301 error, when there is an error on
/auth
. It is committed ondb/7787
Closed #689.
ib/7787