Sha256: 5c79f59d7a40f52b9b3ec725fcb89fb334cc7ecaa5f930a7a6fc85c305617786

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

module SpreeComfy::AuthDevise

  def authenticate
    #include Rails.application.routes.url_helpers  
    if spree_current_user
      
      ability = SpreeComfy::Ability.new(spree_current_user)
      return true if ability.can? :edit, :page
      
      raise CanCan::AccessDenied

    else
      scope = Devise::Mapping.find_scope!(:user)
      session["#{scope}_return_to"] = new_comfy_admin_cms_site_path(:locale => I18n.locale) # if localized...
      redirect_to '/user/spree_user/sign_in'
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_comfy_auth_devise-3.0.0 lib/spree_comfy_auth_devise/auth_devise.rb
spree_comfy_auth_devise-0.0.1 lib/spree_comfy_auth_devise/auth_devise.rb