First
[anni] / lib / pleroma / web / mastodon_api / controllers / auth_controller.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.AuthController do
6   use Pleroma.Web, :controller
7
8   import Pleroma.Web.ControllerHelper, only: [json_response: 3]
9
10   alias Pleroma.Web.TwitterAPI.TwitterAPI
11
12   action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
13
14   plug(Pleroma.Web.Plugs.RateLimiter, [name: :password_reset] when action == :password_reset)
15
16   @doc "POST /auth/password"
17   def password_reset(conn, params) do
18     nickname_or_email = params["email"] || params["nickname"]
19
20     TwitterAPI.password_reset(nickname_or_email)
21
22     json_response(conn, :no_content, "")
23   end
24 end