change cond to if else
This commit is contained in:
parent
1a8bc26e52
commit
8b020e03a6
@ -44,15 +44,11 @@ defmodule Pleroma.Plugs.AuthenticationPlug do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp verify(user, password, _user_id) do
|
defp verify(user, password, _user_id) do
|
||||||
is_legacy = String.starts_with?(user.password_hash, "$6$")
|
|
||||||
|
|
||||||
valid =
|
valid =
|
||||||
cond do
|
if String.starts_with?(user.password_hash, "$6$") do
|
||||||
is_legacy ->
|
:crypt.crypt(password, user.password_hash) == user.password_hash
|
||||||
:crypt.crypt(password, user.password_hash) == user.password_hash
|
else
|
||||||
|
Pbkdf2.checkpw(password, user.password_hash)
|
||||||
true ->
|
|
||||||
Pbkdf2.checkpw(password, user.password_hash)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if valid do
|
if valid do
|
||||||
|
Loading…
Reference in New Issue
Block a user