defmodule Pleroma.Web.OAuth.OAuthController do
use Pleroma.Web, :controller
- alias Pleroma.Web.OAuth
+ alias Pleroma.Web.Auth.DatabaseAuthenticator
alias Pleroma.Web.OAuth.Authorization
alias Pleroma.Web.OAuth.Token
alias Pleroma.Web.OAuth.App
available_scopes = (app && app.scopes) || []
scopes = oauth_scopes(params, nil) || available_scopes
- template = Application.get_env(:pleroma, :auth_template, "show.html")
+ template = Pleroma.Config.get(:auth_template, "show.html")
render(conn, template, %{
response_type: params["response_type"],
"redirect_uri" => redirect_uri
} = auth_params
}) do
- with {_, {:ok, %User{} = user}} <- {:get_user, OAuth.authenticator().get_user(conn)},
+ with {_, {:ok, %User{} = user}} <- {:get_user, DatabaseAuthenticator.get_user(conn)},
%App{} = app <- Repo.get_by(App, client_id: client_id),
true <- redirect_uri in String.split(app.redirect_uris),
scopes <- oauth_scopes(auth_params, []),
|> authorize(auth_params)
error ->
- OAuth.authenticator().handle_error(conn, error)
+ DatabaseAuthenticator.handle_error(conn, error)
end
end