about summary refs log tree commit diff
path: root/users/grfn/bbbg/src/bbbg/handlers/home.clj
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-12-19T05·02-0500
committerclbot <clbot@tvl.fyi>2021-12-19T05·06+0000
commitc6e0f64f452c7dffe7b12d5a45422785b4a7cb2b (patch)
treef8a5a843a0f86dc6d698c19e34575a2045d97322 /users/grfn/bbbg/src/bbbg/handlers/home.clj
parent2bc742964163217982d43d74e4a06968de09d67b (diff)
fix(grfn/bbbg): Properly handle already-existing user r/3299
If a user already exists with the discord ID we just authenticated, just
return it rather than trying to create another user.

Change-Id: I582c4c8c55f6fb399295b3e691b0bc59e77151f4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4410
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--users/grfn/bbbg/src/bbbg/handlers/home.clj2
1 files changed, 1 insertions, 1 deletions
diff --git a/users/grfn/bbbg/src/bbbg/handlers/home.clj b/users/grfn/bbbg/src/bbbg/handlers/home.clj
index 4807065745..4b46675e4c 100644
--- a/users/grfn/bbbg/src/bbbg/handlers/home.clj
+++ b/users/grfn/bbbg/src/bbbg/handlers/home.clj
@@ -35,7 +35,7 @@
      (let [token (get-in request [:oauth2/access-tokens :discord])]
        (if (discord.auth/check-discord-auth env token)
          (let [discord-user (discord/me token)
-               user (db.user/create!
+               user (db.user/find-or-create!
                      db
                      #::user{:username (:username discord-user)
                              :discord-user-id (:id discord-user)})]