diff options
author | feld <feld@feld.me> | 2019-04-06 22:19:30 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2019-04-06 22:19:30 +0000 |
commit | fb2040d06199f2f4190ff363da54d6fcfa87ff69 (patch) | |
tree | 83a0b57b95307184b14db88c8b6f0c659325b538 /lib/pleroma | |
parent | 876965a7e7bc369fcc48e8fc265db0e49569e056 (diff) | |
parent | 7aa53d52bd982b5ab233a65048f5fb1823127d4a (diff) | |
download | pleroma-fb2040d06199f2f4190ff363da54d6fcfa87ff69.tar.gz |
Merge branch 'fix/deactivated-user-error' into 'develop'
Return 403 for deactivated user on token request
Closes #785
See merge request pleroma/pleroma!1031
Diffstat (limited to 'lib/pleroma')
-rw-r--r-- | lib/pleroma/web/oauth/oauth_controller.ex | 6 |
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"}) |