1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-26 17:15:44 +01:00

admin_api_controller.ex: get_password_reset: fix params and response

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-10-12 06:28:20 +02:00
parent 5732eef16b
commit 578a911737
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE

View File

@ -62,11 +62,23 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|> puts(token)
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)
{:ok, token} = Pleroma.PasswordResetToken.create_token(user)
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