Skip to content

Commit

Permalink
Swapping from null to a catchall for falsy values (#711) (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhr-git authored Aug 9, 2024
1 parent e09525c commit 51b8a29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

Expand Down

0 comments on commit 51b8a29

Please sign in to comment.