Module: Lock

Defined in:
lib/lock.rb,
lib/lock/engine.rb,
lib/generators/lock/create_password_file/create_password_file_generator.rb

Defined Under Namespace

Classes: CreatePasswordFileGenerator, Engine

Class Method Summary collapse

Class Method Details

.passwords_match?(password) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
# File 'lib/lock.rb', line 6

def self.passwords_match?(password)
  begin
    hashed_combo = IO.read("#{Rails.root}/config/lock_password")
  rescue
    return false
  end
  salt = hashed_combo[0,29]
  hashed_combo==BCrypt::Engine.hash_secret(password, salt)
end