Class: Spree::AdminUser

Inherits:
Object
  • Object
show all
Includes:
AccountDeactivation, AccountLockout, AdminUserMethods, PasswordPolicy
Defined in:
app/models/spree/admin_user.rb

Constant Summary

Constants included from AdminUserMethods

Spree::AdminUserMethods::STATUSES

Constants included from RansackableAttributes

RansackableAttributes::RESTRICTED_AUDIENCES

Constants included from PrefixedId

PrefixedId::SQIDS

Constants included from Actor

Spree::Actor::BUILT_IN_KINDS

Instance Method Summary collapse

Methods included from AccountDeactivation

#deactivate!, #deactivated?, #reactivate!

Methods included from AccountLockout

#locked?, #record_failed_attempt!, #reset_failed_attempts!

Methods included from AdminUserMethods

#active_sessions, #can_be_deleted?, #full_name, #status

Methods included from RansackableAttributes

restricted_audience?, scope_type_from_signature, signature_hidden?

Methods included from PrefixedId

#assign_attributes, decode_prefixed_id, #prefixed_id, prefixed_id?, #to_param

Methods included from Actor

#actor_kind, #actor_label

Instance Method Details

#valid_password?(password) ⇒ Boolean

Back-compat with callers and auth strategies that check valid_password?. Guards a blank digest (password-less accounts) so it returns false instead of raising BCrypt::Errors::InvalidHash on older Rails/bcrypt versions.

Parameters:

  • password (String)

Returns:

  • (Boolean)


21
22
23
24
25
# File 'app/models/spree/admin_user.rb', line 21

def valid_password?(password)
  return false if password_digest.blank?

  authenticate(password).present?
end