diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2024-09-08 20:48:21 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2024-09-08 20:48:21 +0000 |
commit | 20e82c7456b7045930a47eaea2b8aa6733a91f49 (patch) | |
tree | 1ac00e2916c41b0b2ec40e810d15277ddebef1fa /lib | |
parent | bb0cb06d8a3a9e97d3b39d712ee5a7147c25ee84 (diff) | |
parent | 7e91c3a306b8f050e6a88e888fd439b579c1f125 (diff) | |
download | pleroma-20e82c7456b7045930a47eaea2b8aa6733a91f49.tar.gz pleroma-20e82c7456b7045930a47eaea2b8aa6733a91f49.zip |
Merge branch 'argon2' into 'develop'
Support and convert argon2 passwords
See merge request pleroma/pleroma!4257
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/plugs/authentication_plug.ex | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex index f912a1542..af7d7f45a 100644 --- a/lib/pleroma/web/plugs/authentication_plug.ex +++ b/lib/pleroma/web/plugs/authentication_plug.ex @@ -47,6 +47,11 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlug do Pleroma.Password.Pbkdf2.verify_pass(password, password_hash) end + def checkpw(password, "$argon2" <> _ = password_hash) do + # Handle argon2 passwords for Akkoma migration + Argon2.verify_pass(password, password_hash) + end + def checkpw(_password, _password_hash) do Logger.error("Password hash not recognized") false @@ -56,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 |