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