summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMint <mint@plagu.ee>2024-09-08 05:32:40 +0300
committerMint <mint@plagu.ee>2024-09-08 05:32:40 +0300
commit9de522ce5048bd72dd083a1661506b563be27cc1 (patch)
tree7570859c0b3103e5db21d08298a6e5cca729eff2 /lib
parentc9b28eaf9a484fa1f2c27d00855c997575369782 (diff)
downloadpleroma-9de522ce5048bd72dd083a1661506b563be27cc1.tar.gz
pleroma-9de522ce5048bd72dd083a1661506b563be27cc1.zip
Authentication: convert argon2 passwords, add tests
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/plugs/authentication_plug.ex5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex
index 3fc6e7b51..af7d7f45a 100644
--- a/lib/pleroma/web/plugs/authentication_plug.ex
+++ b/lib/pleroma/web/plugs/authentication_plug.ex
@@ -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