Sha256: 2daaec10150492f4d10a7c7ca32dc9bb7c235ca43e31ddff052b950171da5710

Contents?: true

Size: 829 Bytes

Versions: 2

Compression:

Stored size: 829 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

2 entries across 2 versions & 1 rubygems

Version Path
ab_admin-0.6.1 lib/ab_admin/devise.rb
ab_admin-0.6.0 lib/ab_admin/devise.rb