Assign token to connection
authorMartin Kühl <martin.kuehl@gmail.com>
Tue, 18 Sep 2018 09:39:06 +0000 (11:39 +0200)
committerMartin Kühl <martin.kuehl@gmail.com>
Sat, 22 Sep 2018 05:04:01 +0000 (07:04 +0200)
lib/pleroma/plugs/oauth_plug.ex

index 0380ce14db4d0dac270686ad5a8d5633f01d3286..651485e092d53fbf1d7ded4828e599246859d762 100644 (file)
@@ -18,10 +18,11 @@ defmodule Pleroma.Plugs.OAuthPlug do
       end
 
     with token when not is_nil(token) <- token,
-         %Token{user_id: user_id} <- Repo.get_by(Token, token: token),
+         %Token{user_id: user_id} = token <- Repo.get_by(Token, token: token),
          %User{} = user <- Repo.get(User, user_id),
          false <- !!user.info["deactivated"] do
       conn
+      |> assign(:token, token)
       |> assign(:user, user)
     else
       _ -> conn