module Clearance::PasswordStrategies::BCryptMigrationFromSHA1

Public Instance Methods

authenticated?(password) click to toggle source
# File lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb, line 24
def authenticated?(password)
  authenticated_with_sha1?(password) || authenticated_with_bcrypt?(password)
end
password=(new_password) click to toggle source
# File lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb, line 28
def password=(new_password)
  @password = new_password
  BCryptUser.new(self).password = new_password
end

Private Instance Methods

authenticated_with_bcrypt?(password) click to toggle source
# File lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb, line 35
def authenticated_with_bcrypt?(password)
  begin
    BCryptUser.new(self).authenticated? password
  rescue ::BCrypt::Errors::InvalidHash
    false
  end
end
authenticated_with_sha1?(password) click to toggle source
# File lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb, line 43
def authenticated_with_sha1?(password)
  if sha1_password?
    if SHA1User.new(self).authenticated? password
      self.password = password
      self.save
      true
    end
  end
end
sha1_password?() click to toggle source
# File lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb, line 53
def sha1_password?
  self.encrypted_password =~ /^[a-f0-9]{40}$/
end