1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Plugs.LegacyAuthenticationPlug do
8 alias Pleroma.Plugs.OAuthScopesPlug
15 def call(%{assigns: %{user: %User{}}} = conn, _), do: conn
20 auth_user: %{password_hash: "$6$" <> _ = password_hash} = auth_user,
21 auth_credentials: %{password: password}
26 with ^password_hash <- :crypt.crypt(password, password_hash),
28 User.reset_password(auth_user, %{password: password, password_confirmation: password}) do
30 |> assign(:auth_user, user)
31 |> assign(:user, user)
32 |> OAuthScopesPlug.skip_plug()