aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoreugenijm <eugenijm@protonmail.com>2019-04-06 00:22:42 +0300
committereugenijm <eugenijm@protonmail.com>2019-04-06 23:27:55 +0300
commit7aa53d52bd982b5ab233a65048f5fb1823127d4a (patch)
tree3c6e13c0f7f77acd5ba2f65f3bc0f5a34256560d /lib
parente3ca9f708fdb004771708c06095ed7b7e4cfce4d (diff)
downloadpleroma-7aa53d52bd982b5ab233a65048f5fb1823127d4a.tar.gz
Return 403 on oauth token exchange for a deactivated user
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/oauth/oauth_controller.ex6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex
index 26d53df1a..aac8f97fc 100644
--- a/lib/pleroma/web/oauth/oauth_controller.ex
+++ b/lib/pleroma/web/oauth/oauth_controller.ex
@@ -152,6 +152,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
with {_, {:ok, %User{} = user}} <- {:get_user, Authenticator.get_user(conn)},
%App{} = app <- get_app_from_request(conn, params),
{:auth_active, true} <- {:auth_active, User.auth_active?(user)},
+ {:user_active, true} <- {:user_active, !user.info.deactivated},
scopes <- oauth_scopes(params, app.scopes),
[] <- scopes -- app.scopes,
true <- Enum.any?(scopes),
@@ -175,6 +176,11 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|> put_status(:forbidden)
|> json(%{error: "Your login is missing a confirmed e-mail address"})
+ {:user_active, false} ->
+ conn
+ |> put_status(:forbidden)
+ |> json(%{error: "Your account is currently disabled"})
+
_error ->
put_status(conn, 400)
|> json(%{error: "Invalid credentials"})