Handle validated users without profiles

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Format

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-01-30 15:54:21 +01:00
parent 681653e035
commit ce65c992d3
6 changed files with 34 additions and 13 deletions

View File

@@ -63,7 +63,7 @@ defmodule MobilizonWeb.Resolvers.User do
{:get_actor, actor} <- {:get_actor, Actors.get_actor_for_user(user)},
{:guardian_encode_and_sign, {:ok, token, _}} <-
{:guardian_encode_and_sign, MobilizonWeb.Guardian.encode_and_sign(user)} do
{:ok, %{token: token, user: user, person: actor}}
{:ok, %{token: token, user: Map.put(user, :default_actor, actor)}}
else
err ->
Logger.info("Unable to validate user with token #{token}")