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 | |
@@ -60,7 +59,7 b' class AuthLdap(object):' | |||
|
60 | 59 | self.LDAP_SERVER_ADDRESS = server |
|
61 | 60 | self.LDAP_SERVER_PORT = port |
|
62 | 61 | |
|
63 | #USE FOR READ ONLY BIND TO LDAP SERVER | |
|
62 | # USE FOR READ ONLY BIND TO LDAP SERVER | |
|
64 | 63 | self.LDAP_BIND_DN = bind_dn |
|
65 | 64 | self.LDAP_BIND_PASS = bind_pass |
|
66 | 65 |
@@ -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