Module: PasswordAuth

Defined in:
lib/password_auth.rb,
lib/password_auth/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"1.0.2"

Class Method Summary collapse

Class Method Details

.hash_password(password) ⇒ Object



10
11
12
# File 'lib/password_auth.rb', line 10

def hash_password(password)
  BCrypt::Password.create(password)
end

.password_valid?(password, hashed_password) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/password_auth.rb', line 14

def password_valid?(password, hashed_password)
  bcrypt_password = BCrypt::Password.new(hashed_password)
  bcrypt_password == password
end