Module: MnoEnterprise::Concerns::Controllers::Jpi::V1::CurrentUsersController
- Extended by:
- ActiveSupport::Concern
- Included in:
- Jpi::V1::CurrentUsersController
- Defined in:
- lib/mno_enterprise/concerns/controllers/jpi/v1/current_users_controller.rb
Instance Method Summary collapse
-
#show ⇒ Object
Instance methods ================================================================== GET /mnoe/jpi/v1/current_user.
-
#update ⇒ Object
PUT /mnoe/jpi/v1/current_user.
-
#update_password ⇒ Object
PUT /mnoe/jpi/v1/current_user/update_password.
Instance Method Details
#show ⇒ Object
Instance methods
GET /mnoe/jpi/v1/current_user
19 20 21 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/current_users_controller.rb', line 19 def show @user = current_user || MnoEnterprise::User.new end |
#update ⇒ Object
PUT /mnoe/jpi/v1/current_user
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/current_users_controller.rb', line 24 def update @user = current_user @user.assign_attributes(user_params) changes = @user.changes if @user.update(user_params) MnoEnterprise::EventLogger.info('user_update', current_user.id, "User update", changes, @user) render :show else render json: @user.errors, status: :bad_request end end |
#update_password ⇒ Object
PUT /mnoe/jpi/v1/current_user/update_password
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mno_enterprise/concerns/controllers/jpi/v1/current_users_controller.rb', line 38 def update_password @user = current_user if @user.update(password_params.merge(current_password_required: true)) MnoEnterprise::EventLogger.info('user_update_password', current_user.id, "User password change", @user.email, @user) sign_in @user, bypass: true render :show else render json: @user.errors, status: :bad_request end end |