summaryrefslogtreecommitdiff
path: root/users/app/controllers/v1
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-07-02 23:17:44 -0700
committerelijah <elijah@riseup.net>2013-07-04 04:12:59 -0700
commitfa7b7425e7c53282472c1c9ce1cdc7272f55cfd4 (patch)
treee5e1be6d8b273344e5297c2c97b9638ef66e8ba8 /users/app/controllers/v1
parente996432cbd50f4dadaae0ff62ac3f286ab125b1f (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')
-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