feat(server): Server.Auth.verify_password/1
This commit is contained in:
parent
58f22243a5
commit
9c457c1f68
2 changed files with 44 additions and 0 deletions
16
server/lib/server/auth.ex
Normal file
16
server/lib/server/auth.ex
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
defmodule Server.Auth do
|
||||
@moduledoc "Single-user dashboard authentication."
|
||||
|
||||
@spec verify_password(term()) :: :ok | :error
|
||||
def verify_password(password) when is_binary(password) do
|
||||
hash = Application.fetch_env!(:server, :dashboard_password_hash)
|
||||
|
||||
if Argon2.verify_pass(password, hash) do
|
||||
:ok
|
||||
else
|
||||
:error
|
||||
end
|
||||
end
|
||||
|
||||
def verify_password(_), do: :error
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue