admin_api_controller.ex: get_password_reset: fix params and response
This commit is contained in:
parent
5732eef16b
commit
578a911737
|
@ -62,11 +62,23 @@ def get_invite_token(conn, _params) 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
|
||||
|
|
Loading…
Reference in a new issue