philomena/lib/philomena/users/password.ex

14 lines
396 B
Elixir
Raw Normal View History

2019-08-17 20:58:36 +02:00
defmodule Philomena.Users.Password do
def hash_pwd_salt(password, opts \\ []) do
2019-11-13 04:12:46 +01:00
Bcrypt.hash_pwd_salt(<<password::binary, password_pepper()::binary>>, opts)
2019-08-17 20:58:36 +02:00
end
def verify_pass(password, stored_hash) do
2019-11-13 04:12:46 +01:00
Bcrypt.verify_pass(<<password::binary, password_pepper()::binary>>, stored_hash)
end
2019-08-17 20:58:36 +02:00
2019-11-13 04:12:46 +01:00
defp password_pepper do
Application.get_env(:philomena, :password_pepper)
2019-08-17 20:58:36 +02:00
end
end