From 67c1cb9bf186fa51dbe1c17e090a0abfb061b3f5 Mon Sep 17 00:00:00 2001 From: Sheen Capadngan Date: Fri, 23 Aug 2024 15:40:06 +0800 Subject: [PATCH] fix: this pr addresses null null name issue with invited users --- backend/src/services/auth/auth-login-service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts index 2ce900b47..91bf40198 100644 --- a/backend/src/services/auth/auth-login-service.ts +++ b/backend/src/services/auth/auth-login-service.ts @@ -583,7 +583,13 @@ export const authLoginServiceFactory = ({ } else { const isLinkingRequired = !user?.authMethods?.includes(authMethod); if (isLinkingRequired) { - user = await userDAL.updateById(user.id, { authMethods: [...(user.authMethods || []), authMethod] }); + // we update the names here because upon org invitation, the names are set to be NULL + // if user is signing up with SSO after invitation, their names should be set based on their SSO profile + user = await userDAL.updateById(user.id, { + authMethods: [...(user.authMethods || []), authMethod], + firstName: !user.isAccepted ? firstName : undefined, + lastName: !user.isAccepted ? lastName : undefined + }); } }