Sha256: b97a46cf9aafbfc9c44ce208fa9fc25633f3ee55f6a2258274b7d4d3c6bfa6e0

Contents?: true

Size: 787 Bytes

Versions: 39

Compression:

Stored size: 787 Bytes

Contents

module Locomotive
  class AccountsController < BaseController

    account_required & within_site

    def new
      authorize Membership
      @account = Account.new(email: params[:email])
      respond_with @account
    end

    def create
      authorize Membership
      @account = Account.create(account_params)
      service.create(@account) if @account.errors.empty?
      respond_with @account, location: edit_current_site_path(current_site)
    end

    private

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

    def service
      policy = MembershipPolicy.new(pundit_user, @membership || Membership)
      @service ||= Locomotive::MembershipService.new(current_site, policy)
    end

  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.2.0.alpha1 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.1.1 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.1.0 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.1.0.rc1 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.3 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.2 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.1 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.0 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.0.rc0 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.0.alpha3 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.4.1 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.0.alpha2 app/controllers/locomotive/accounts_controller.rb
locomotivecms-4.0.0.alpha1 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.4.0 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.3.0 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.3.0.rc3 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.3.0.rc2 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.1.2 app/controllers/locomotive/accounts_controller.rb
locomotivecms-3.2.1 app/controllers/locomotive/accounts_controller.rb