summaryrefslogtreecommitdiff
path: root/users/app/controllers/v1/users_controller.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-07-02 23:17:44 -0700
committerelijah <elijah@riseup.net>2013-07-02 23:17:44 -0700
commit96206389a863f105bd0b37dcdb9d00b7c30d8b51 (patch)
treeb79e91b2dbc9af76b2077c9b854791aac9720833 /users/app/controllers/v1/users_controller.rb
parentfbe23fc59814f0b27dbc1073c34f03a6d22cab99 (diff)
users engine changes - rewrite of the views, separate email settings to a separate controller, make users_controller html only and v1/users_controller json only.
Diffstat (limited to 'users/app/controllers/v1/users_controller.rb')
-rw-r--r--users/app/controllers/v1/users_controller.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/users/app/controllers/v1/users_controller.rb b/users/app/controllers/v1/users_controller.rb
index 617bd4b..e7516bc 100644
--- a/users/app/controllers/v1/users_controller.rb
+++ b/users/app/controllers/v1/users_controller.rb
@@ -1,8 +1,9 @@
module V1
- class UsersController < ApplicationController
+ class UsersController < UsersBaseController
skip_before_filter :verify_authenticity_token
before_filter :authorize, :only => [:update]
+ before_filter :fetch_user, :only => [:update]
respond_to :json
@@ -12,9 +13,11 @@ module V1
end
def update
- # For now, only allow public key to be updated via the API. Eventually we might want to store in a config what attributes can be updated via the API.
@user = User.find_by_param(params[:id])
- @user.update_attributes params[:user].slice(:public_key) if params[:user].respond_to?(:slice)
+ @user.update_attributes params[:user]
+ if @user.valid?
+ flash[:notice] = t(:user_updated_successfully)
+ end
respond_with @user
end