aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/server
diff options
context:
space:
mode:
authorkamtschatka <simon.schatka@gmx.at>2024-09-23 22:53:41 +0200
committerGitHub <noreply@github.com>2024-09-23 21:53:41 +0100
commite1feeceda475b117dde99a971f87e20a149f7edf (patch)
tree3c201c2741ff1131563994fc0d3f80a61638876e /apps/web/server
parentfb0336b55452157f62fed4b4ebfe5ce72d55a48b (diff)
downloadkarakeep-e1feeceda475b117dde99a971f87e20a149f7edf.tar.zst
fix(web): Change names to be optional when signing up via SSO. #410 (#412)
using email address as fallback, if the name is not available
Diffstat (limited to 'apps/web/server')
-rw-r--r--apps/web/server/auth.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/web/server/auth.ts b/apps/web/server/auth.ts
index 483d1522..042be1ae 100644
--- a/apps/web/server/auth.ts
+++ b/apps/web/server/auth.ts
@@ -114,7 +114,7 @@ if (oauth.wellKnownUrl) {
]);
return {
id: profile.sub,
- name: profile.name,
+ name: profile.name || profile.email,
email: profile.email,
image: profile.picture,
role: admin || firstUser ? "admin" : "user",
@@ -146,7 +146,7 @@ export const authOptions: NextAuthOptions = {
if (credentials) {
return true;
}
- if (!profile?.email || !profile?.name) {
+ if (!profile?.email) {
throw new Error("No profile");
}
const [{ count: userCount }] = await db