From: Haelwenn (lanodan) Monnier Date: Fri, 12 Oct 2018 04:28:20 +0000 (+0200) Subject: admin_api_controller.ex: get_password_reset: fix params and response X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=578a9117370c3756c56448ad663664f73155a50b;p=akkoma admin_api_controller.ex: get_password_reset: fix params and response --- diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex index a6f8cd4d3..0cc84430d 100644 --- a/lib/pleroma/web/admin_api/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/admin_api_controller.ex @@ -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