From 51b8a29b5b03e9212d9aa539ac926b2e44c3c2d5 Mon Sep 17 00:00:00 2001 From: lhr-git <102617425+lhr-git@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:14:22 -0400 Subject: [PATCH] Swapping from null to a catchall for falsy values (#711) (#712) --- pages/api/auth/[...nextauth].ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index ee9cb6928..3bb1efd9c 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -103,9 +103,12 @@ export const authOptions: NextAuthOptions = { //Validate SIN and UID to ensure they are not null and are alphanumeric const sinRegex = /^[a-zA-Z0-9]+$/ - if (profile.sin === null || !sinRegex.test(profile.sin)) { + if (Boolean(profile.sin) === false || !sinRegex.test(profile.sin)) { logger.error('SIN is not valid') - } else if (profile.uid === null || !sinRegex.test(profile.uid)) { + } else if ( + Boolean(profile.uid) === false || + !sinRegex.test(profile.uid) + ) { logger.error('UID is not valid') }