X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Foauth%2Foauth_controller.ex;h=ec70b7ccc9379482510a4919cd5e2e30b55be1b8;hb=34fc0dca2e879bcbb73acc80fdc72678411d0ebf;hp=5c2b0507c9a0c8c5dc48fb0dff643986c22d55b8;hpb=cf426a719dfe26a11b0bf0a22a08fd45ca5b9dc2;p=akkoma diff --git a/lib/pleroma/web/oauth/oauth_controller.ex b/lib/pleroma/web/oauth/oauth_controller.ex index 5c2b0507c..ec70b7ccc 100644 --- a/lib/pleroma/web/oauth/oauth_controller.ex +++ b/lib/pleroma/web/oauth/oauth_controller.ex @@ -5,13 +5,13 @@ defmodule Pleroma.Web.OAuth.OAuthController do use Pleroma.Web, :controller - alias Pleroma.Web.Auth.DatabaseAuthenticator - alias Pleroma.Web.OAuth.Authorization - alias Pleroma.Web.OAuth.Token - alias Pleroma.Web.OAuth.App + alias Comeonin.Pbkdf2 alias Pleroma.Repo alias Pleroma.User - alias Comeonin.Pbkdf2 + alias Pleroma.Web.Auth.Authenticator + alias Pleroma.Web.OAuth.App + alias Pleroma.Web.OAuth.Authorization + alias Pleroma.Web.OAuth.Token import Pleroma.Web.ControllerHelper, only: [oauth_scopes: 2] @@ -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, Authenticator.auth_template(), %{ response_type: params["response_type"], client_id: params["client_id"], available_scopes: available_scopes, @@ -45,7 +43,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do "redirect_uri" => redirect_uri } = auth_params }) do - with {_, {:ok, %User{} = user}} <- {:get_user, DatabaseAuthenticator.get_user(conn)}, + with {_, {:ok, %User{} = user}} <- {:get_user, Authenticator.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, []), @@ -98,7 +96,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do |> authorize(auth_params) error -> - DatabaseAuthenticator.handle_error(conn, error) + Authenticator.handle_error(conn, error) end end @@ -115,7 +113,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do refresh_token: token.refresh_token, created_at: DateTime.to_unix(inserted_at), expires_in: 60 * 10, - scope: Enum.join(token.scopes) + scope: Enum.join(token.scopes, " ") } json(conn, response)