projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma]
/
lib
/
pleroma
/
web
/
mongooseim
/
mongoose_im_controller.ex
diff --git
a/lib/pleroma/web/mongooseim/mongoose_im_controller.ex
b/lib/pleroma/web/mongooseim/mongoose_im_controller.ex
index f8c634653f8dc21815e1e6e2a2e6eb5f1e1a7aa1..358600e7d1ff34c0bc308fb80f4c831b6e10a459 100644
(file)
--- a/
lib/pleroma/web/mongooseim/mongoose_im_controller.ex
+++ b/
lib/pleroma/web/mongooseim/mongoose_im_controller.ex
@@
-4,9
+4,14
@@
defmodule Pleroma.Web.MongooseIM.MongooseIMController do
use Pleroma.Web, :controller
defmodule Pleroma.Web.MongooseIM.MongooseIMController do
use Pleroma.Web, :controller
+
alias Comeonin.Pbkdf2
alias Comeonin.Pbkdf2
- alias Pleroma.
Us
er
+ alias Pleroma.
Plugs.RateLimit
er
alias Pleroma.Repo
alias Pleroma.Repo
+ alias Pleroma.User
+
+ plug(RateLimiter, [name: :authentication] when action in [:user_exists, :check_password])
+ plug(RateLimiter, [name: :authentication, params: ["user"]] when action == :check_password)
def user_exists(conn, %{"user" => username}) do
with %User{} <- Repo.get_by(User, nickname: username, local: true) do
def user_exists(conn, %{"user" => username}) do
with %User{} <- Repo.get_by(User, nickname: username, local: true) do
@@
-29,7
+34,7
@@
defmodule Pleroma.Web.MongooseIM.MongooseIMController do
else
false ->
conn
else
false ->
conn
- |> put_status(
403
)
+ |> put_status(
:forbidden
)
|> json(false)
_ ->
|> json(false)
_ ->