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.Web.Plugs.LegacyAuthenticationPlug do
14 def call(%{assigns: %{user: %User{}}} = conn, _), do: conn
19 auth_user: %{password_hash: "$6$" <> _ = password_hash} = auth_user,
20 auth_credentials: %{password: password}
25 with ^password_hash <- :crypt.crypt(password, password_hash),
27 User.reset_password(auth_user, %{password: password, password_confirmation: password}) do
29 |> assign(:auth_user, user)
30 |> assign(:user, user)
31 |> Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug()