Show More
@@ -136,6 +136,7 b' class MyAccountView(BaseAppView, DataGri' | |||||
136 | except forms.ValidationFailure as e: |
|
136 | except forms.ValidationFailure as e: | |
137 | c.form = e |
|
137 | c.form = e | |
138 | return self._get_template_context(c) |
|
138 | return self._get_template_context(c) | |
|
139 | ||||
139 | except Exception: |
|
140 | except Exception: | |
140 | log.exception("Exception updating user") |
|
141 | log.exception("Exception updating user") | |
141 | h.flash(_('Error occurred during update of user'), |
|
142 | h.flash(_('Error occurred during update of user'), |
@@ -144,6 +144,10 b' class NotAllowedToCreateUserError(Except' | |||||
144 | pass |
|
144 | pass | |
145 |
|
145 | |||
146 |
|
146 | |||
|
147 | class DuplicateUpdateUserError(Exception): | |||
|
148 | pass | |||
|
149 | ||||
|
150 | ||||
147 | class RepositoryCreationError(Exception): |
|
151 | class RepositoryCreationError(Exception): | |
148 | pass |
|
152 | pass | |
149 |
|
153 |
@@ -37,7 +37,7 b' from rhodecode.lib.str_utils import safe' | |||||
37 | from rhodecode.lib.exceptions import ( |
|
37 | from rhodecode.lib.exceptions import ( | |
38 | DefaultUserException, UserOwnsReposException, UserOwnsRepoGroupsException, |
|
38 | DefaultUserException, UserOwnsReposException, UserOwnsRepoGroupsException, | |
39 | UserOwnsUserGroupsException, NotAllowedToCreateUserError, |
|
39 | UserOwnsUserGroupsException, NotAllowedToCreateUserError, | |
40 | UserOwnsPullRequestsException, UserOwnsArtifactsException) |
|
40 | UserOwnsPullRequestsException, UserOwnsArtifactsException, DuplicateUpdateUserError) | |
41 | from rhodecode.lib.caching_query import FromCache |
|
41 | from rhodecode.lib.caching_query import FromCache | |
42 | from rhodecode.model import BaseModel |
|
42 | from rhodecode.model import BaseModel | |
43 | from rhodecode.model.db import ( |
|
43 | from rhodecode.model.db import ( | |
@@ -308,6 +308,10 b' class UserModel(BaseModel):' | |||||
308 | log.debug('Checking for existing account in RhodeCode ' |
|
308 | log.debug('Checking for existing account in RhodeCode ' | |
309 | 'database with user_id `%s` ', updating_user_id) |
|
309 | 'database with user_id `%s` ', updating_user_id) | |
310 | user = User.get(updating_user_id) |
|
310 | user = User.get(updating_user_id) | |
|
311 | # now also validate if USERNAME belongs to potentially other user | |||
|
312 | maybe_other_user = User.get_by_username(username, case_insensitive=True) | |||
|
313 | if maybe_other_user and maybe_other_user.user_id != updating_user_id: | |||
|
314 | raise DuplicateUpdateUserError(f'different user exists with the {username} username') | |||
311 | else: |
|
315 | else: | |
312 | log.debug('Checking for existing account in RhodeCode ' |
|
316 | log.debug('Checking for existing account in RhodeCode ' | |
313 | 'database with username `%s` ', username) |
|
317 | 'database with username `%s` ', username) |
General Comments 0
You need to be logged in to leave comments.
Login now