admin_api_controller.ex: get_password_reset: fix params and response
This commit is contained in:
parent
5732eef16b
commit
578a911737
@ -62,11 +62,23 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||||||
|> puts(token)
|
|> puts(token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_password_reset(conn, %{nickname: nickname}) do
|
def get_password_reset(conn, %{"nickname" => nickname}) do
|
||||||
(%User{local: true} = user) = User.get_by_nickname(nickname)
|
(%User{local: true} = user) = User.get_by_nickname(nickname)
|
||||||
{:ok, token} = Pleroma.PasswordResetToken.create_token(user)
|
{:ok, token} = Pleroma.PasswordResetToken.create_token(user)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> puts(token)
|
|> json(token.token)
|
||||||
|
end
|
||||||
|
|
||||||
|
def errors(conn, {:param_cast, _}) do
|
||||||
|
conn
|
||||||
|
|> put_status(400)
|
||||||
|
|> json("Invalid parameters")
|
||||||
|
end
|
||||||
|
|
||||||
|
def errors(conn, _) do
|
||||||
|
conn
|
||||||
|
|> put_status(500)
|
||||||
|
|> json("Something went wrong")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user