Sha256: d07abf7e9b1fb563a154f40ab861d0415238a6224cdede230e5d34bd9188f439

Contents?: true

Size: 913 Bytes

Versions: 17

Compression:

Stored size: 913 Bytes

Contents

module Locomotive
  class MyAccountController < BaseController

    account_required

    respond_to :json, only: [:regenerate_api_key]

    before_filter :load_account

    layout '/locomotive/layouts/account'

    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

17 entries across 17 versions & 1 rubygems

Version Path
locomotivecms-3.3.0 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.3.0.rc3 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.3.0.rc2 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.1.2 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.2.1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.3.0.rc1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.2.0 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.2.0.rc2 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.2.0.rc1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.1.1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.1.0 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.1.0.rc3 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.1.0.rc2 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.1.0.rc1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.1 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0 app/controllers/locomotive/my_account_controller.rb
locomotivecms-3.0.0.rc7 app/controllers/locomotive/my_account_controller.rb