projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New mix tasks for controlling user confirmation status and sending confirmation mails
[akkoma]
/
lib
/
pleroma
/
web
/
mastodon_api
/
controllers
/
auth_controller.ex
diff --git
a/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex
b/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex
index bfd5120ba4bfb2ffa38cf2827c3ade35d5cced20..9f09550e1c97e372f1e812a336c46243d68e7fac 100644
(file)
--- a/
lib/pleroma/web/mastodon_api/controllers/auth_controller.ex
+++ b/
lib/pleroma/web/mastodon_api/controllers/auth_controller.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AuthController do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AuthController do
@@
-13,9
+13,9
@@
defmodule Pleroma.Web.MastodonAPI.AuthController do
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
- @local_mastodon_name "Mastodon-Local"
+ plug(Pleroma.Plugs.RateLimiter, [name: :password_reset] when action == :password_reset)
- plug(Pleroma.Plugs.RateLimiter, :password_reset when action == :password_reset)
+ @local_mastodon_name "Mastodon-Local"
@doc "GET /web/login"
def login(%{assigns: %{user: %User{}}} = conn, _params) do
@doc "GET /web/login"
def login(%{assigns: %{user: %User{}}} = conn, _params) do
@@
-59,17
+59,11
@@
defmodule Pleroma.Web.MastodonAPI.AuthController do
def password_reset(conn, params) do
nickname_or_email = params["email"] || params["nickname"]
def password_reset(conn, params) do
nickname_or_email = params["email"] || params["nickname"]
- with {:ok, _} <- TwitterAPI.password_reset(nickname_or_email) do
- conn
- |> put_status(:no_content)
- |> json("")
- else
- {:error, "unknown user"} ->
- send_resp(conn, :not_found, "")
-
- {:error, _} ->
- send_resp(conn, :bad_request, "")
- end
+ TwitterAPI.password_reset(nickname_or_email)
+
+ conn
+ |> put_status(:no_content)
+ |> json("")
end
defp local_mastodon_root_path(conn) do
end
defp local_mastodon_root_path(conn) do
@@
-86,6
+80,6
@@
defmodule Pleroma.Web.MastodonAPI.AuthController do
@spec get_or_make_app() :: {:ok, App.t()} | {:error, Ecto.Changeset.t()}
defp get_or_make_app do
%{client_name: @local_mastodon_name, redirect_uris: "."}
@spec get_or_make_app() :: {:ok, App.t()} | {:error, Ecto.Changeset.t()}
defp get_or_make_app do
%{client_name: @local_mastodon_name, redirect_uris: "."}
- |> App.get_or_make(["read", "write", "follow", "push"])
+ |> App.get_or_make(["read", "write", "follow", "push"
, "admin"
])
end
end
end
end