X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fo_auth%2Ftoken.ex;h=6e91b62166768a8d7f5386e78a8b9cdf02236728;hb=aa681d7e15f6170e7e92d86146d5ba96be6433bc;hp=886117d155fe5b1ed2d2cd908fc2994db8d0cb15;hpb=d501e55ec7fbb31d3baef548f9f773648c13896e;p=akkoma diff --git a/lib/pleroma/web/o_auth/token.ex b/lib/pleroma/web/o_auth/token.ex index 886117d15..6e91b6216 100644 --- a/lib/pleroma/web/o_auth/token.ex +++ b/lib/pleroma/web/o_auth/token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token do @@ -39,6 +39,12 @@ defmodule Pleroma.Web.OAuth.Token do |> Repo.find_resource() end + def get_preexisting_by_app_and_user(%App{} = app, %User{} = user) do + app.id + |> Query.get_unexpired_by_app_and_user(user) + |> Repo.find_resource() + end + @doc "Gets token for app by access token" @spec get_by_token(App.t(), String.t()) :: {:ok, t()} | {:error, :not_found} def get_by_token(%App{id: app_id} = _app, token) do