Assign token to connection
This commit is contained in:
parent
3193423be9
commit
c2d592c9c5
|
@ -18,10 +18,11 @@ def call(conn, _) do
|
||||||
end
|
end
|
||||||
|
|
||||||
with token when not is_nil(token) <- token,
|
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),
|
%User{} = user <- Repo.get(User, user_id),
|
||||||
false <- !!user.info["deactivated"] do
|
false <- !!user.info["deactivated"] do
|
||||||
conn
|
conn
|
||||||
|
|> assign(:token, token)
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
else
|
else
|
||||||
_ -> conn
|
_ -> conn
|
||||||
|
|
Loading…
Reference in New Issue