Class: Spree::Customer

Inherits:
Object
  • Object
show all
Includes:
AccountLockout, CustomerMethods, PasswordPolicy
Defined in:
app/models/spree/customer.rb

Constant Summary

Constants included from Publishable

Publishable::LIFECYCLE_ACTIONS

Constants included from RansackableAttributes

RansackableAttributes::RESTRICTED_AUDIENCES

Constants included from PrefixedId

PrefixedId::SQIDS

Instance Method Summary collapse

Methods included from AccountLockout

#locked?, #record_failed_attempt!, #reset_failed_attempts!

Methods included from CustomerMethods

#anonymized?, #available_store_credits, #can_be_deleted?, #default_wishlist_for_store, #event_serializer_class, #full_name, #last_incomplete_spree_order, #newsletter_subscriber, #scramble_email_and_names, #to_csv, #total_available_store_credit

Methods included from SanitizableRichText

declaring_models

Methods included from Publishable

#event_context, #event_payload, #event_payload_for, #event_prefix, #event_serializer_class, #publish_event, #touch

Methods included from RansackableAttributes

restricted_audience?, scope_type_from_signature, signature_hidden?

Methods included from UserReporting

#amount_spent_in, #average_order_value, #completed_orders_for_store, #display_amount_spent_in, #lifetime_value, #order_count, #report_values_for

Methods included from DisplayMoney

#money_methods

Methods included from PrefixedId

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

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)


28
29
30
31
32
# File 'app/models/spree/customer.rb', line 28

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

  authenticate(password).present?
end