Sha256: 10cb3cad55954da50a79bb62581e5393dd32c748fa855bcde0096f4e7121fe4d

Contents?: true

Size: 831 Bytes

Versions: 9

Compression:

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

9 entries across 9 versions & 1 rubygems

Version Path
ab_admin-0.5.0 lib/ab_admin/devise.rb
ab_admin-0.4.0 lib/ab_admin/devise.rb
ab_admin-0.3.6 lib/ab_admin/devise.rb
ab_admin-0.3.5 lib/ab_admin/devise.rb
ab_admin-0.3.4 lib/ab_admin/devise.rb
ab_admin-0.3.3 lib/ab_admin/devise.rb
ab_admin-0.3.2 lib/ab_admin/devise.rb
ab_admin-0.3.1 lib/ab_admin/devise.rb
ab_admin-0.3.0 lib/ab_admin/devise.rb