summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-14 17:41:19 +0200
committerJames Lopez <james@jameslopez.es>2017-06-23 11:41:41 +0200
commit85b5a8cfa6b21d65ab09d2f1a4c270a85d6d1f0f (patch)
treeace0f78c98cb63b1e7af281260bdb7790999ad91
parent1c14805ff185bcc5b8a23ad081f9d7012479e30d (diff)
downloadgitlab-ce-85b5a8cfa6b21d65ab09d2f1a4c270a85d6d1f0f.tar.gz
update users controller
-rw-r--r--app/controllers/admin/users_controller.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index b09eef17c23..f6af171fb04 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -125,14 +125,17 @@ class Admin::UsersController < Admin::ApplicationController
respond_to do |format|
user.skip_reconfirmation!
- if user.update_attributes(user_params_with_pass)
+
+ result = Users::UpdateService.new(current_user, @user, user_params_with_pass).execute
+
+ if result[:succcess]
format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' }
format.json { head :ok }
else
# restore username to keep form action url.
user.username = params[:id]
format.html { render "edit" }
- format.json { render json: user.errors, status: :unprocessable_entity }
+ format.json { render json: result[:message], status: result[:status] }
end
end
end