Show More
@@ -103,6 +103,13 def authfunc(environ, username, password | |||
|
103 | 103 | |
|
104 | 104 | |
|
105 | 105 | else: |
|
106 | ||
|
107 | #since ldap is searching in case insensitive check if this user is still | |
|
108 | #not in our system | |
|
109 | username = username.lower() | |
|
110 | if user_model.get_by_username(username, cache=False) is not None: | |
|
111 | return False | |
|
112 | ||
|
106 | 113 | from rhodecode.model.settings import SettingsModel |
|
107 | 114 | ldap_settings = SettingsModel().get_ldap_settings() |
|
108 | 115 | |
@@ -110,6 +117,7 def authfunc(environ, username, password | |||
|
110 | 117 | # FALLBACK TO LDAP AUTH IN ENABLE |
|
111 | 118 | #====================================================================== |
|
112 | 119 | if ldap_settings.get('ldap_active', False): |
|
120 | ||
|
113 | 121 | kwargs = { |
|
114 | 122 | 'server':ldap_settings.get('ldap_host', ''), |
|
115 | 123 | 'base_dn':ldap_settings.get('ldap_base_dn', ''), |
@@ -214,8 +222,8 def fill_perms(user): | |||
|
214 | 222 | |
|
215 | 223 | #default global |
|
216 | 224 | default_global_perms = sa.query(UserToPerm)\ |
|
217 |
.filter(UserToPerm.user == sa.query(User) |
|
|
218 | 'default').one()) | |
|
225 | .filter(UserToPerm.user == sa.query(User)\ | |
|
226 | .filter(User.username == 'default').one()) | |
|
219 | 227 | |
|
220 | 228 | for perm in default_global_perms: |
|
221 | 229 | user.permissions['global'].add(perm.permission.permission_name) |
@@ -67,7 +67,7 def ValidUsername(edit, old_data): | |||
|
67 | 67 | old_un = UserModel().get(old_data.get('user_id')).username |
|
68 | 68 | |
|
69 | 69 | if old_un != value or not edit: |
|
70 | if UserModel().get_by_username(value, cache=False): | |
|
70 | if UserModel().get_by_username(value.lower(), cache=False): | |
|
71 | 71 | raise formencode.Invalid(_('This username already exists') , |
|
72 | 72 | value, state) |
|
73 | 73 | |
@@ -244,6 +244,8 class ValidPath(formencode.validators.Fa | |||
|
244 | 244 | def UniqSystemEmail(old_data): |
|
245 | 245 | class _UniqSystemEmail(formencode.validators.FancyValidator): |
|
246 | 246 | def to_python(self, value, state): |
|
247 | value = value.lower() | |
|
248 | #TODO:write test for MixedCase scenarios | |
|
247 | 249 | if old_data.get('email') != value: |
|
248 | 250 | sa = meta.Session() |
|
249 | 251 | try: |
@@ -260,6 +262,7 def UniqSystemEmail(old_data): | |||
|
260 | 262 | |
|
261 | 263 | class ValidSystemEmail(formencode.validators.FancyValidator): |
|
262 | 264 | def to_python(self, value, state): |
|
265 | value = value.lower() | |
|
263 | 266 | sa = meta.Session |
|
264 | 267 | try: |
|
265 | 268 | user = sa.query(User).filter(User.email == value).scalar() |
General Comments 0
You need to be logged in to leave comments.
Login now