projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix race in enforcer/reclaimer start
[akkoma]
/
lib
/
pleroma
/
plugs
/
legacy_authentication_plug.ex
diff --git
a/lib/pleroma/plugs/legacy_authentication_plug.ex
b/lib/pleroma/plugs/legacy_authentication_plug.ex
index 48c0aba8825989aed635062d62439c7e4046e209..d346e01a6fd515263239bc725a369bdd248fc8fd 100644
(file)
--- a/
lib/pleroma/plugs/legacy_authentication_plug.ex
+++ b/
lib/pleroma/plugs/legacy_authentication_plug.ex
@@
-1,5
+1,11
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Plugs.LegacyAuthenticationPlug do
import Plug.Conn
defmodule Pleroma.Plugs.LegacyAuthenticationPlug do
import Plug.Conn
+
+ alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
def init(options) do
alias Pleroma.User
def init(options) do
@@
-17,11
+23,16
@@
defmodule Pleroma.Plugs.LegacyAuthenticationPlug do
} = conn,
_
) 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
conn
- |> assign(:user, auth_user)
+ |> assign(:auth_user, user)
+ |> assign(:user, user)
+ |> OAuthScopesPlug.skip_plug()
else
else
- conn
+ _ ->
+ conn
end
end
end
end