Module: Revise::Models::Authenticatable

Extended by:
ActiveSupport::Concern
Defined in:
lib/revise/models/authenticatable.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

MAILERS =
[]
HELPERS =
['Authentication']
CONTROLLERS =
['Main', 'Sessions', 'Accounts']
BLACKLIST_FOR_SERIALIZATION =
[:encrypted_password, :reset_password_token, :reset_password_sent_at, :role,
:remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip,
:last_sign_in_ip, :password_salt, :confirmation_token, :confirmed_at, :confirmation_sent_at,
:remember_token, :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at, :authentication_token, :role, 
:roles]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.required_fields(klass) ⇒ Object



22
23
24
# File 'lib/revise/models/authenticatable.rb', line 22

def self.required_fields(klass)
  [:role]
end

Instance Method Details

#active_for_authentication?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/revise/models/authenticatable.rb', line 34

def active_for_authentication?
  true
end

#inactive_messageObject



38
39
40
# File 'lib/revise/models/authenticatable.rb', line 38

def inactive_message
  :inactive
end

#password_required?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/revise/models/authenticatable.rb', line 42

def password_required?
  encrypted_password.blank? || password.present?
end

#role?(role) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
# File 'lib/revise/models/authenticatable.rb', line 46

def role?(role)
  return false unless self.respond_to?(:role)
  return self.role.to_sym == role.to_sym
end

#unauthenticated_messageObject



30
31
32
# File 'lib/revise/models/authenticatable.rb', line 30

def unauthenticated_message
  :invalid
end

#valid_for_authentication?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/revise/models/authenticatable.rb', line 26

def valid_for_authentication?
  block_given? ? yield : true
end