Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Swapping from null to a catchall for falsy values (#711) (#712)
  • Loading branch information
lhr-git authored Aug 9, 2024
commit 51b8a29b5b03e9212d9aa539ac926b2e44c3c2d5
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