mastoapi password reset
added rate limit to password reset configure rate limit in runtime
This commit is contained in:
parent
33fbb638cd
commit
10f82c88b8
8 changed files with 90 additions and 6 deletions
|
|
@ -27,6 +27,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
|||
|
||||
require Logger
|
||||
|
||||
plug(Pleroma.Plugs.RateLimiter, :password_reset when action == :password_reset)
|
||||
plug(:only_if_public_instance when action in [:public_timeline, :public_and_external_timeline])
|
||||
action_fallback(:errors)
|
||||
|
||||
|
|
@ -437,6 +438,12 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
|||
|
||||
with {:ok, _} <- TwitterAPI.password_reset(nickname_or_email) do
|
||||
json_response(conn, :no_content, "")
|
||||
else
|
||||
{:error, "unknown user"} ->
|
||||
put_status(conn, :not_found)
|
||||
|
||||
{:error, _} ->
|
||||
put_status(conn, :bad_request)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue