changeset 7882:1943c6f00cd8 stable

user: allow LDAP users with non-ASCII characters in the DN The database and sqlalchemy use unicode, so any attempt at storing encoded data is wrong and might fail. Thus, use safe_unicode instead of encoding it using safe_str.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 31 Jul 2019 21:31:23 +0200
parents 5763182f79b5
children 90e50aa705ee d7a0b79eb047
files kallithea/model/user.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/user.py	Wed May 22 12:49:38 2019 +0200
+++ b/kallithea/model/user.py	Wed Jul 31 21:31:23 2019 +0200
@@ -37,7 +37,7 @@
 
 from sqlalchemy.exc import DatabaseError
 
-from kallithea.lib.utils2 import safe_str, generate_api_key, get_current_authuser
+from kallithea.lib.utils2 import safe_unicode, generate_api_key, get_current_authuser
 from kallithea.lib.caching_query import FromCache
 from kallithea.model.db import Permission, User, UserToPerm, \
     UserEmailMap, UserIpMap
@@ -145,9 +145,9 @@
             new_user.admin = admin
             new_user.email = email
             new_user.active = active
-            new_user.extern_name = safe_str(extern_name) \
+            new_user.extern_name = safe_unicode(extern_name) \
                 if extern_name else None
-            new_user.extern_type = safe_str(extern_type) \
+            new_user.extern_type = safe_unicode(extern_type) \
                 if extern_type else None
             new_user.name = firstname
             new_user.lastname = lastname