##// END OF EJS Templates
fixed issues with not unique emails when using ldap or container auth.
marcink -
r1690:6944b124 beta
parent child Browse files
Show More
@@ -43,8 +43,7 b' class AuthLdap(object):'
43 43 def __init__(self, server, base_dn, port=389, bind_dn='', bind_pass='',
44 44 tls_kind='PLAIN', tls_reqcert='DEMAND', ldap_version=3,
45 45 ldap_filter='(&(objectClass=user)(!(objectClass=computer)))',
46 search_scope='SUBTREE',
47 attr_login='uid'):
46 search_scope = 'SUBTREE', attr_login = 'uid'):
48 47 self.ldap_version = ldap_version
49 48 ldap_server_type = 'ldap'
50 49
@@ -149,6 +149,10 b' class UserModel(BaseModel):'
149 149 :param attrs:
150 150 """
151 151 if self.get_by_username(username, case_insensitive=True) is None:
152
153 # autogenerate email for container account without one
154 generate_email = lambda usr: '%s@container_auth.account' % usr
155
152 156 try:
153 157 new_user = User()
154 158 new_user.username = username
@@ -156,7 +160,7 b' class UserModel(BaseModel):'
156 160 new_user.api_key = generate_api_key(username)
157 161 new_user.email = attrs['email']
158 162 new_user.active = attrs.get('active', True)
159 new_user.name = attrs['name']
163 new_user.name = attrs['name'] or generate_email(username)
160 164 new_user.lastname = attrs['lastname']
161 165
162 166 self.sa.add(new_user)
General Comments 0
You need to be logged in to leave comments. Login now