diff options
author | lambda <lain@soykaf.club> | 2019-04-08 09:18:01 +0000 |
---|---|---|
committer | lambda <lain@soykaf.club> | 2019-04-08 09:18:01 +0000 |
commit | b4da2bc1d009ecca0d7821abe3577d1a920c41c0 (patch) | |
tree | c75ce1ec6e70724c29efe540a2439de635abc160 /test/web/oauth | |
parent | cfa6e7289f5cfdb1fce17eb89bc0513ff624480d (diff) | |
parent | b177e1e7f330ff1531be190949db7f75e378a449 (diff) | |
download | pleroma-b4da2bc1d009ecca0d7821abe3577d1a920c41c0.tar.gz |
Merge branch 'develop' into 'improve_upgrade_user_from_ap_id'
# Conflicts:
# config/config.exs
# docs/config.md
Diffstat (limited to 'test/web/oauth')
-rw-r--r-- | test/web/oauth/oauth_controller_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs index a9a0b9ed4..a68528420 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -327,6 +327,32 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do refute Map.has_key?(resp, "access_token") end + test "rejects token exchange for valid credentials belonging to deactivated user" do + password = "testpassword" + + user = + insert(:user, + password_hash: Comeonin.Pbkdf2.hashpwsalt(password), + info: %{deactivated: true} + ) + + app = insert(:oauth_app) + + conn = + build_conn() + |> post("/oauth/token", %{ + "grant_type" => "password", + "username" => user.nickname, + "password" => password, + "client_id" => app.client_id, + "client_secret" => app.client_secret + }) + + assert resp = json_response(conn, 403) + assert %{"error" => _} = resp + refute Map.has_key?(resp, "access_token") + end + test "rejects an invalid authorization code" do app = insert(:oauth_app) |