Added `auth_template/0` to DatabaseAuthenticator.

This commit is contained in:
Ivan Tashkinov 2019-02-28 13:58:58 +03:00
parent b6f915313f
commit 4e77f68414
3 changed files with 8 additions and 3 deletions

View File

@ -17,4 +17,9 @@ def get_user(plug), do: implementation().get_user(plug)
@callback handle_error(Plug.Conn.t(), any()) :: any() @callback handle_error(Plug.Conn.t(), any()) :: any()
def handle_error(plug, error), do: implementation().handle_error(plug, error) 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 end

View File

@ -23,4 +23,6 @@ def get_user(%Plug.Conn{} = conn) do
def handle_error(%Plug.Conn{} = _conn, error) do def handle_error(%Plug.Conn{} = _conn, error) do
error error
end end
def auth_template, do: nil
end end

View File

@ -25,9 +25,7 @@ def authorize(conn, params) do
available_scopes = (app && app.scopes) || [] available_scopes = (app && app.scopes) || []
scopes = oauth_scopes(params, nil) || available_scopes scopes = oauth_scopes(params, nil) || available_scopes
template = Pleroma.Config.get(:auth_template, "show.html") render(conn, DatabaseAuthenticator.auth_template(), %{
render(conn, template, %{
response_type: params["response_type"], response_type: params["response_type"],
client_id: params["client_id"], client_id: params["client_id"],
available_scopes: available_scopes, available_scopes: available_scopes,