From: Ivan Tashkinov Date: Thu, 28 Feb 2019 10:58:58 +0000 (+0300) Subject: Added `auth_template/0` to DatabaseAuthenticator. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4e77f68414c1dd6a906d1d9b6b78916db5c213d5;p=akkoma Added `auth_template/0` to DatabaseAuthenticator. --- diff --git a/lib/pleroma/web/auth/database_authenticator.ex b/lib/pleroma/web/auth/database_authenticator.ex index e78068b03..494f28f23 100644 --- a/lib/pleroma/web/auth/database_authenticator.ex +++ b/lib/pleroma/web/auth/database_authenticator.ex @@ -17,4 +17,9 @@ defmodule Pleroma.Web.Auth.DatabaseAuthenticator do @callback handle_error(Plug.Conn.t(), any()) :: any() def handle_error(plug, error), do: implementation().handle_error(plug, error) + + @callback auth_template() :: String.t() | nil + def auth_template do + implementation().auth_template() || Pleroma.Config.get(:auth_template, "show.html") + end end diff --git a/lib/pleroma/web/auth/pleroma_database_authenticator.ex b/lib/pleroma/web/auth/pleroma_database_authenticator.ex index 39aa1a586..0780388bc 100644 --- a/lib/pleroma/web/auth/pleroma_database_authenticator.ex +++ b/lib/pleroma/web/auth/pleroma_database_authenticator.ex @@ -23,4 +23,6 @@ defmodule Pleroma.Web.Auth.PleromaDatabaseAuthenticator do def handle_error(%Plug.Conn{} = _conn, error) do error end + + def auth_template, do: nil end diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex index 5c2b0507c..99346f399 100644 --- a/lib/pleroma/web/oauth/oauth_controller.ex +++ b/lib/pleroma/web/oauth/oauth_controller.ex @@ -25,9 +25,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do available_scopes = (app && app.scopes) || [] scopes = oauth_scopes(params, nil) || available_scopes - template = Pleroma.Config.get(:auth_template, "show.html") - - render(conn, template, %{ + render(conn, DatabaseAuthenticator.auth_template(), %{ response_type: params["response_type"], client_id: params["client_id"], available_scopes: available_scopes,