Authentication: convert argon2 passwords, add tests
This commit is contained in:
parent
c9b28eaf9a
commit
9de522ce50
2 changed files with 31 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlug do
|
|||
end
|
||||
|
||||
def checkpw(password, "$argon2" <> _ = password_hash) do
|
||||
# Handle argon2 passwords for Akkoma migration
|
||||
Argon2.verify_pass(password, password_hash)
|
||||
end
|
||||
|
||||
|
|
@ -60,6 +61,10 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlug do
|
|||
do_update_password(user, password)
|
||||
end
|
||||
|
||||
def maybe_update_password(%User{password_hash: "$argon2" <> _} = user, password) do
|
||||
do_update_password(user, password)
|
||||
end
|
||||
|
||||
def maybe_update_password(user, _), do: {:ok, user}
|
||||
|
||||
defp do_update_password(user, password) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue