diff options
author | Simponic <elizabeth.hunt@simponic.xyz> | 2023-01-31 20:59:01 -0700 |
---|---|---|
committer | Simponic <elizabeth.hunt@simponic.xyz> | 2023-01-31 20:59:01 -0700 |
commit | 800d479863af3e0548bb5c77d229aa1b9a2c143f (patch) | |
tree | 68c7ee449eab7bc66019e2e14c862d6b662b4d50 /lib/chessh/web | |
parent | e4c387d7a5f5cda17ea5a8eb58b998f553821ea3 (diff) | |
download | chessh-800d479863af3e0548bb5c77d229aa1b9a2c143f.tar.gz chessh-800d479863af3e0548bb5c77d229aa1b9a2c143f.zip |
Add discriminator to username when oauth'd
Diffstat (limited to 'lib/chessh/web')
-rw-r--r-- | lib/chessh/web/web.ex | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chessh/web/web.ex b/lib/chessh/web/web.ex index aac57fc..2b465b2 100644 --- a/lib/chessh/web/web.ex +++ b/lib/chessh/web/web.ex @@ -267,11 +267,12 @@ defmodule Chessh.Web.Endpoint do [] ) do {:ok, {{_, 200, 'OK'}, _, user_details}} -> - %{"username" => username, "id" => discord_id} = + %{"username" => username, "discriminator" => discriminator, "id" => discord_id} = Jason.decode!(String.Chars.to_string(user_details)) %Player{id: id} = - Repo.insert!(%Player{discord_id: discord_id, username: username}, + Repo.insert!( + %Player{discord_id: discord_id, username: username <> "#" <> discriminator}, on_conflict: [set: [discord_id: discord_id]], conflict_target: :discord_id ) |