Sha256: d7cdeebfea1feecab0bb615c0918d5e99bd4e6714f15715819eb526fc9d9bb6d

Contents?: true

Size: 840 Bytes

Versions: 7

Compression:

Stored size: 840 Bytes

Contents

require 'devise'

module AbAdmin
  module Devise

    def self.config
      {
        :controllers => {
            :sessions => 'ab_admin/devise/sessions',
            :passwords => 'ab_admin/devise/passwords'
        }
      }
    end

    module Controller
      extend ::ActiveSupport::Concern
      included do
        layout 'admin/devise'
      end
    end

    class SessionsController < ::Devise::SessionsController
      include ::AbAdmin::Devise::Controller

      def after_sign_in_path_for(resource)
        stored_location_for(resource) ||
            if resource.is_a?(User) && resource.moderator?
              admin_root_path
            else
              super
            end
      end
    end

    class PasswordsController < ::Devise::PasswordsController
      include ::AbAdmin::Devise::Controller
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 lib/ab_admin/devise.rb
ab_admin-0.2.2 lib/ab_admin/devise.rb
ab_admin-0.2.1 lib/ab_admin/devise.rb
ab_admin-0.2.0 lib/ab_admin/devise.rb
ab_admin-0.1.2 lib/ab_admin/devise.rb
ab_admin-0.1.1 lib/ab_admin/devise.rb
ab_admin-0.1.0 lib/ab_admin/devise.rb