Sha256: e88a753b6e572849f46de2cbe1dbfc51c89053f3664a2f279a85ec8359ef2807

Contents?: true

Size: 779 Bytes

Versions: 10

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

# Concern for Devise enhancements
# eg. User approval and password expiry
#
module Renalware
  module Deviseable
    extend ActiveSupport::Concern

    included do
      class_eval do
        devise(:expirable, :database_authenticatable, :registerable,
               :rememberable, :trackable, :validatable, :timeoutable, :recoverable)
      end

      # Makes the User 'approvable'
      # See https://github.com/plataformatec/devise/wiki/How-To:-Require-admin-to-activate-account-before-sign_in
      def active_for_authentication?
        super && approved?
      end

      def inactive_message
        if approved?
          super
        else
          :not_approved
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/concerns/renalware/deviseable.rb
renalware-core-2.1.0 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.167 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.166 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.165 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.164 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.163 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.162 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.161 app/models/concerns/renalware/deviseable.rb
renalware-core-2.0.160 app/models/concerns/renalware/deviseable.rb