diff options
author | lain <lain@soykaf.club> | 2020-05-17 11:40:25 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-17 11:40:25 +0200 |
commit | bfdd90f6d7c9bb85e572033070d6fa7efda8aeac (patch) | |
tree | 46090fc1ce89f5a57bc9ffaac2ddbb1e2bffc5f2 /lib | |
parent | baef35bcc8685757b0039f76d2614bbb08e410f7 (diff) | |
download | pleroma-bfdd90f6d7c9bb85e572033070d6fa7efda8aeac.tar.gz |
AuthenticationPlug: Also update crypt passwords.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/plugs/authentication_plug.ex | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/plugs/authentication_plug.ex b/lib/pleroma/plugs/authentication_plug.ex index 7d7da6125..057ea42f1 100644 --- a/lib/pleroma/plugs/authentication_plug.ex +++ b/lib/pleroma/plugs/authentication_plug.ex @@ -31,6 +31,16 @@ defmodule Pleroma.Plugs.AuthenticationPlug do end def maybe_update_password(%User{password_hash: "$2" <> _} = user, password) do + do_update_password(user, password) + end + + def maybe_update_password(%User{password_hash: "$6" <> _} = user, password) do + do_update_password(user, password) + end + + def maybe_update_password(user, _), do: {:ok, user} + + defp do_update_password(user, password) do user |> User.password_update_changeset(%{ "password" => password, @@ -39,8 +49,6 @@ defmodule Pleroma.Plugs.AuthenticationPlug do |> Pleroma.Repo.update() end - def maybe_update_password(user, _), do: {:ok, user} - def call(%{assigns: %{user: %User{}}} = conn, _), do: conn def call( |