Update legacy passwords automatically.
This commit is contained in:
parent
c0e067c74e
commit
44b094908c
2 changed files with 23 additions and 9 deletions
|
|
@ -17,11 +17,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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue