[#2025] Defaulted OAuth login scopes choice to all scopes when user selects no scopes.
authorIvan Tashkinov <ivantashkinov@gmail.com>
Thu, 6 Aug 2020 13:00:00 +0000 (16:00 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Thu, 6 Aug 2020 13:00:00 +0000 (16:00 +0300)
lib/pleroma/web/oauth/oauth_controller.ex

index f29b3cb5705f7d46160f8dc70167f5e32322d322..dd00600ea5ce3c7e67450e8706b8fdc0fb2f122f 100644 (file)
@@ -76,6 +76,13 @@ defmodule Pleroma.Web.OAuth.OAuthController do
     available_scopes = (app && app.scopes) || []
     scopes = Scopes.fetch_scopes(params, available_scopes)
 
+    scopes =
+      if scopes == [] do
+        available_scopes
+      else
+        scopes
+      end
+
     # Note: `params` might differ from `conn.params`; use `@params` not `@conn.params` in template
     render(conn, Authenticator.auth_template(), %{
       response_type: params["response_type"],