Module: Clearance::PasswordStrategies::Blowfish

Defined in:
lib/clearance/password_strategies/blowfish.rb

Constant Summary collapse

DEPRECATION_MESSAGE =
"[DEPRECATION] The Blowfish password strategy " \
"has been deprecated and will be removed from Clearance 2.0. BCrypt " \
"is the only officially supported strategy, though you are free to " \
"provide your own. To continue using this strategy add " \
"clearance-deprecated_password_strategies to your Gemfile."

Instance Method Summary collapse

Instance Method Details

#authenticated?(password) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/clearance/password_strategies/blowfish.rb', line 13

def authenticated?(password)
  warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
  encrypted_password == encrypt(password)
end

#password=(new_password) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/clearance/password_strategies/blowfish.rb', line 18

def password=(new_password)
  warn "#{Kernel.caller.first}: #{DEPRECATION_MESSAGE}"
  @password = new_password
  initialize_salt_if_necessary

  if new_password.present?
    self.encrypted_password = encrypt(new_password)
  end
end