X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fplugs%2Flegacy_authentication_plug.ex;h=5c5c36c560a494b24c78a55c21d0637c70d3671e;hb=aa78325117c879ecb7ec76383c239078275adbd9;hp=48c0aba8825989aed635062d62439c7e4046e209;hpb=a3f54fca4d67fd7938ae00752c2cd409b6cf15ae;p=akkoma diff --git a/lib/pleroma/plugs/legacy_authentication_plug.ex b/lib/pleroma/plugs/legacy_authentication_plug.ex index 48c0aba88..5c5c36c56 100644 --- a/lib/pleroma/plugs/legacy_authentication_plug.ex +++ b/lib/pleroma/plugs/legacy_authentication_plug.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Plugs.LegacyAuthenticationPlug do import Plug.Conn alias Pleroma.User @@ -17,11 +21,15 @@ defmodule Pleroma.Plugs.LegacyAuthenticationPlug do } = conn, _ ) do - if :crypt.crypt(password, password_hash) == password_hash do + with ^password_hash <- :crypt.crypt(password, password_hash), + {:ok, user} <- + User.reset_password(auth_user, %{password: password, password_confirmation: password}) do conn - |> assign(:user, auth_user) + |> assign(:auth_user, user) + |> assign(:user, user) else - conn + _ -> + conn end end