Merge branch '2130-mfa-users-oauth-login-fix' into 'develop'
authorrinpatch <rinpatch@sdf.org>
Thu, 10 Sep 2020 18:38:48 +0000 (18:38 +0000)
committerrinpatch <rinpatch@sdf.org>
Thu, 10 Sep 2020 18:38:48 +0000 (18:38 +0000)
[#2130] Fixed OAuth OOB authentication for users with enabled MFA

Closes #2130

See merge request pleroma/pleroma!2979

lib/pleroma/web/oauth/oauth_controller.ex
lib/pleroma/web/templates/o_auth/o_auth/oob_authorization_created.html.eex
lib/pleroma/web/templates/o_auth/o_auth/oob_token_exists.html.eex

index dd00600ea5ce3c7e67450e8706b8fdc0fb2f122f..06b116368b637d4c4462e82958346744e425107a 100644 (file)
@@ -145,7 +145,10 @@ defmodule Pleroma.Web.OAuth.OAuthController do
   def after_create_authorization(%Plug.Conn{} = conn, %Authorization{} = auth, %{
         "authorization" => %{"redirect_uri" => @oob_token_redirect_uri}
       }) do
-    render(conn, "oob_authorization_created.html", %{auth: auth})
+    # Enforcing the view to reuse the template when calling from other controllers
+    conn
+    |> put_view(OAuthView)
+    |> render("oob_authorization_created.html", %{auth: auth})
   end
 
   def after_create_authorization(%Plug.Conn{} = conn, %Authorization{} = auth, %{
index 8443d906b5c4cd20c993c0d893d4b912fc766506..ffabe29a624ad85c67cd5e5ab5553bc9dde80cce 100644 (file)
@@ -1,2 +1,2 @@
 <h1>Successfully authorized</h1>
-<h2>Token code is <%= @auth.token %></h2>
+<h2>Token code is <br><%= @auth.token %></h2>
index 961aad976843dba2f3d82084c13a791c0722a8fb..82785c4b99bede3011b23c3e8a44d4b64751bd2a 100644 (file)
@@ -1,2 +1,2 @@
 <h1>Authorization exists</h1>
-<h2>Access token is <%= @token.token %></h2>
+<h2>Access token is <br><%= @token.token %></h2>