1
0
Fork 1
forked from fedi/mastodon
mastodon/app/controllers/api/v1/accounts/credentials_controller.rb
Matt Jankowski 73540ffe6b Clean up for api/base controller (#3629)
* Move ApiController to Api/BaseController

* API controllers inherit from Api::BaseController

* Add coverage for various error cases in api/base controller
2017-06-07 20:09:25 +02:00

24 lines
513 B
Ruby

# frozen_string_literal: true
class Api::V1::Accounts::CredentialsController < Api::BaseController
before_action -> { doorkeeper_authorize! :write }, only: [:update]
before_action :require_user!
def show
@account = current_account
render 'api/v1/accounts/show'
end
def update
current_account.update!(account_params)
@account = current_account
render 'api/v1/accounts/show'
end
private
def account_params
params.permit(:display_name, :note, :avatar, :header)
end
end