2019-10-01 02:54:45 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-12 23:49:20 -07:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2019-10-01 02:54:45 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.MastodonAPI.AuthController do
|
|
|
|
use Pleroma.Web, :controller
|
|
|
|
|
2020-09-21 12:56:40 -06:00
|
|
|
import Pleroma.Web.ControllerHelper, only: [json_response: 3]
|
|
|
|
|
2019-10-01 02:54:45 -06:00
|
|
|
alias Pleroma.Web.TwitterAPI.TwitterAPI
|
|
|
|
|
|
|
|
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
|
|
|
|
|
2020-06-24 00:35:00 -06:00
|
|
|
plug(Pleroma.Web.Plugs.RateLimiter, [name: :password_reset] when action == :password_reset)
|
2019-10-01 02:54:45 -06:00
|
|
|
|
|
|
|
@doc "POST /auth/password"
|
|
|
|
def password_reset(conn, params) do
|
|
|
|
nickname_or_email = params["email"] || params["nickname"]
|
|
|
|
|
2020-09-02 11:11:24 -06:00
|
|
|
TwitterAPI.password_reset(nickname_or_email)
|
|
|
|
|
2020-09-21 12:56:40 -06:00
|
|
|
json_response(conn, :no_content, "")
|
2019-10-01 02:54:45 -06:00
|
|
|
end
|
|
|
|
end
|