Renaming a user name with an existing user name
Change error message when we try rename user name with an existing user name. Change-Id: I2dbf9fee3c682a70c77544a8dd6b925311a3f019 Closes-Bug: #1389132
This commit is contained in:
parent
b17ba715aa
commit
95db4eb709
|
@ -333,6 +333,8 @@ def user_update(request, user, **data):
|
|||
# Update user details
|
||||
try:
|
||||
user = manager.update(user, **data)
|
||||
except keystone_exceptions.Conflict:
|
||||
raise exceptions.Conflict()
|
||||
except Exception:
|
||||
error = exceptions.handle(request, ignore=True)
|
||||
|
||||
|
@ -372,7 +374,10 @@ def user_update(request, user, **data):
|
|||
else:
|
||||
if not data['password']:
|
||||
data.pop('password')
|
||||
user = manager.update(user, **data)
|
||||
try:
|
||||
user = manager.update(user, **data)
|
||||
except keystone_exceptions.Conflict:
|
||||
raise exceptions.Conflict()
|
||||
if data.get('password') and user.id == request.user.id:
|
||||
return utils.logout_with_message(
|
||||
request,
|
||||
|
|
|
@ -199,13 +199,16 @@ class UpdateUserForm(BaseUserForm):
|
|||
|
||||
data.pop('domain_id')
|
||||
data.pop('domain_name')
|
||||
|
||||
try:
|
||||
if "email" in data:
|
||||
data['email'] = data['email'] or None
|
||||
response = api.keystone.user_update(request, user, **data)
|
||||
messages.success(request,
|
||||
_('User has been updated successfully.'))
|
||||
except exceptions.Conflict:
|
||||
msg = _('User name "%s" is already used.') % data['name']
|
||||
messages.error(request, msg)
|
||||
return False
|
||||
except Exception:
|
||||
response = exceptions.handle(request, ignore=True)
|
||||
messages.error(request, _('Unable to update the user.'))
|
||||
|
|
Loading…
Reference in New Issue