logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

set_user_session_id_plug.ex (484B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.Plugs.SetUserSessionIdPlug do
  5. alias Pleroma.Helpers.AuthHelper
  6. alias Pleroma.Web.OAuth.Token
  7. def init(opts) do
  8. opts
  9. end
  10. def call(%{assigns: %{token: %Token{} = oauth_token}} = conn, _) do
  11. AuthHelper.put_session_token(conn, oauth_token.token)
  12. end
  13. def call(conn, _), do: conn
  14. end