Module: Clearance::PasswordStrategies::SHA1 Deprecated

Extended by:
ActiveSupport::Concern
Defined in:
lib/clearance/password_strategies/sha1.rb

Overview

Deprecated.

Use BCrypt or clearance-deprecated_password_strategies gem

Constant Summary collapse

DEPRECATION_MESSAGE =
"[DEPRECATION] The SHA1 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

Deprecated.

Use BCrypt or clearance-deprecated_password_strategies gem

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/clearance/password_strategies/sha1.rb', line 17

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

#password=(new_password) ⇒ Object

Deprecated.

Use BCrypt or clearance-deprecated_password_strategies gem



24
25
26
27
28
29
30
31
32
# File 'lib/clearance/password_strategies/sha1.rb', line 24

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