Sha256: 13e11c173c51fda7584e6988933897ea0ef2eb4134ce150fbefcbffed1e203f0

Contents?: true

Size: 918 Bytes

Versions: 10

Compression:

Stored size: 918 Bytes

Contents

module Locomotive
  class MyAccountController < BaseController

    account_required

    respond_to :json, only: [:regenerate_api_key]

    before_filter :load_account

    layout '/locomotive/layouts/without_site'

    def edit
      authorize @account
      respond_with @account
    end

    def update
      authorize @account
      @account.update_attributes(account_params)
      respond_with @account, location: edit_my_account_path(anchor: params[:active_tab])
    end

    def regenerate_api_key
      authorize @account, :update?
      @account.regenerate_api_key!
      respond_with({ api_key: @account.api_key }, location: edit_my_account_path)
    end

    private

    def load_account
      @account = current_locomotive_account
    end

    def account_params
      params.require(:account).permit(:name, :email, :password, :password_confirmation, :avatar, :remove_avatar, :locale)
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc6 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.rc5 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.rc4 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.rc3 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.rc2 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.rc1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.pre.beta.1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.pre.alpha.3 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.pre.alpha.2 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.pre.alpha app/controllers/locomotive/my_account_controller.rb