Skip to content

Commit

Permalink
fixes snippet and updates depedency versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Mar 18, 2024
1 parent ba9cf99 commit c6ba133
Show file tree
Hide file tree
Showing 35 changed files with 141 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ function InvalidClaimHandler(props: React.PropsWithChildren<any>) {
return null;
}

if (sessionContext.invalidClaims.some(i => i.validatorId === EmailVerificationClaim.id)) {
if (sessionContext.invalidClaims.some(i => i.id === EmailVerificationClaim.id)) {
// Alternatively you could redirect the user to the email verification screen to trigger the verification email
// Note: /auth/verify-email is the default email verification path
// window.location.assign("/auth/verify-email")
Expand Down Expand Up @@ -1126,7 +1126,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email is not verified
}
}
Expand All @@ -1151,7 +1151,7 @@ async function shouldLoadRoute() {
let validationErrors = await Session.validateClaims(/*{...}*/);
// highlight-start
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email verification claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -1224,7 +1224,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email is not verified
// Send the verification email to the user
await sendEmail();
Expand Down Expand Up @@ -1276,7 +1276,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === supertokensEmailVerification.EmailVerificationClaim.id) {
if (err.id === supertokensEmailVerification.EmailVerificationClaim.id) {
// email is not verified
// Send the verification email to the user
await sendEmail();
Expand Down Expand Up @@ -1340,7 +1340,7 @@ async function callProtectedRoute() {
if (axios.isAxiosError(error) && error.response?.status === 403) {
let validationErrors = await Session.validateClaims();
for (let err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email verification claim check failed
// We call the sendEmail function defined in the previous section to send the verification email.
// await sendEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ async function shouldAllowAccessToProtectedPage() {
// all checks passed
return true;
}
if (validatorFailures.some(i => i.validatorId === SecondFactorClaim.id)) {
if (validatorFailures.some(i => i.id === SecondFactorClaim.id)) {
// 2fa check failed
return false;
}
Expand Down Expand Up @@ -990,7 +990,7 @@ async function shouldAllowAccessToProtectedPage() {
// all checks passed
return true;
}
if (validatorFailures.some(i => i.validatorId === SecondFactorClaim.id)) {
if (validatorFailures.some(i => i.id === SecondFactorClaim.id)) {
// 2fa check failed
return false;
}
Expand Down Expand Up @@ -1057,7 +1057,7 @@ async function shouldAllowAccessToProtectedPage() {
// all checks passed
return true;
}
if (validatorFailures.some(i => i.validatorId === SecondFactorClaim.id)) {
if (validatorFailures.some(i => i.id === SecondFactorClaim.id)) {
// 2fa check failed
return false;
}
Expand Down Expand Up @@ -2308,7 +2308,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -2395,7 +2395,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -2466,7 +2466,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === supertokensUserRoles.UserRoleClaim.id) {
if (err.id === supertokensUserRoles.UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -2747,7 +2747,7 @@ const Dashboard = () => {
return null;
}

if (sessionContext.invalidClaims.some(i => i.validatorId === SecondFactorClaim.id)) {
if (sessionContext.invalidClaims.some(i => i.id === SecondFactorClaim.id)) {
// the 2fa check failed. We should redirect the user to the second
// factor screen.
return "You cannot access this page because you have not completed 2FA";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -456,7 +456,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -527,7 +527,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === supertokensUserRoles.UserRoleClaim.id) {
if (err.id === supertokensUserRoles.UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down
6 changes: 3 additions & 3 deletions v2/emailpassword/custom-ui/enable-email-verification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email is not verified
}
}
Expand Down Expand Up @@ -693,7 +693,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === supertokensEmailVerification.EmailVerificationClaim.id) {
if (err.id === supertokensEmailVerification.EmailVerificationClaim.id) {
// email is not verified
}
}
Expand Down Expand Up @@ -729,7 +729,7 @@ async function callProtectedRoute() {
if (axios.isAxiosError(error) && error.response?.status === 403) {
let validationErrors = await Session.validateClaims();
for (let err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email verification claim check failed
// We call the sendEmail function defined in the next section to send the verification email.
// await sendEmail();
Expand Down
4 changes: 2 additions & 2 deletions v2/emailpassword/pre-built-ui/enable-email-verification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ function InvalidClaimHandler(props: React.PropsWithChildren<any>) {
return null;
}

if (sessionContext.invalidClaims.some(i => i.validatorId === EmailVerificationClaim.id)) {
if (sessionContext.invalidClaims.some(i => i.id === EmailVerificationClaim.id)) {
// Alternatively you could redirect the user to the email verification screen to trigger the verification email
// Note: /auth/verify-email is the default email verification path
// window.location.assign("/auth/verify-email")
Expand Down Expand Up @@ -745,7 +745,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email is not verified
}
}
Expand Down
6 changes: 3 additions & 3 deletions v2/emailpassword/user-roles/protecting-routes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -1326,7 +1326,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -1393,7 +1393,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === supertokensUserRoles.UserRoleClaim.id) {
if (err.id === supertokensUserRoles.UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down
6 changes: 3 additions & 3 deletions v2/mfa/protect-routes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === MultiFactorAuthClaim.id) {
if (err.id === MultiFactorAuthClaim.id) {
// user has not finished MFA factors.
let mfaClaimValue = await Session.getClaimValue({
claim: MultiFactorAuthClaim
Expand Down Expand Up @@ -931,7 +931,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === MultiFactorAuthClaim.id) {
if (err.id === MultiFactorAuthClaim.id) {
// user has not finished MFA factors.
let mfaClaimValue = await Session.getClaimValue({
claim: MultiFactorAuthClaim
Expand Down Expand Up @@ -964,7 +964,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === supertokensMultiFactorAuth.MultiFactorAuthClaim.id) {
if (err.id === supertokensMultiFactorAuth.MultiFactorAuthClaim.id) {
// user has not finished MFA factors.
let mfaClaimValue = await supertokensSession.getClaimValue({
claim: supertokensMultiFactorAuth.MultiFactorAuthClaim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ function InvalidClaimHandler(props: React.PropsWithChildren<any>) {
return null;
}

if (sessionContext.invalidClaims.some(i => i.validatorId === EmailVerificationClaim.id)) {
if (sessionContext.invalidClaims.some(i => i.id === EmailVerificationClaim.id)) {
// Alternatively you could redirect the user to the email verification screen to trigger the verification email
// Note: /auth/verify-email is the default email verification path
// window.location.assign("/auth/verify-email")
Expand Down Expand Up @@ -1126,7 +1126,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email is not verified
}
}
Expand All @@ -1151,7 +1151,7 @@ async function shouldLoadRoute() {
let validationErrors = await Session.validateClaims(/*{...}*/);
// highlight-start
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email verification claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -1224,7 +1224,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email is not verified
// Send the verification email to the user
await sendEmail();
Expand Down Expand Up @@ -1276,7 +1276,7 @@ async function shouldLoadRoute(): Promise<boolean> {
return true;
} else {
for (const err of validationErrors) {
if (err.validatorId === supertokensEmailVerification.EmailVerificationClaim.id) {
if (err.id === supertokensEmailVerification.EmailVerificationClaim.id) {
// email is not verified
// Send the verification email to the user
await sendEmail();
Expand Down Expand Up @@ -1340,7 +1340,7 @@ async function callProtectedRoute() {
if (axios.isAxiosError(error) && error.response?.status === 403) {
let validationErrors = await Session.validateClaims();
for (let err of validationErrors) {
if (err.validatorId === EmailVerificationClaim.id) {
if (err.id === EmailVerificationClaim.id) {
// email verification claim check failed
// We call the sendEmail function defined in the previous section to send the verification email.
// await sendEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ async function shouldAllowAccessToProtectedPage() {
// all checks passed
return true;
}
if (validatorFailures.some(i => i.validatorId === SecondFactorClaim.id)) {
if (validatorFailures.some(i => i.id === SecondFactorClaim.id)) {
// 2fa check failed
return false;
}
Expand Down Expand Up @@ -990,7 +990,7 @@ async function shouldAllowAccessToProtectedPage() {
// all checks passed
return true;
}
if (validatorFailures.some(i => i.validatorId === SecondFactorClaim.id)) {
if (validatorFailures.some(i => i.id === SecondFactorClaim.id)) {
// 2fa check failed
return false;
}
Expand Down Expand Up @@ -1057,7 +1057,7 @@ async function shouldAllowAccessToProtectedPage() {
// all checks passed
return true;
}
if (validatorFailures.some(i => i.validatorId === SecondFactorClaim.id)) {
if (validatorFailures.some(i => i.id === SecondFactorClaim.id)) {
// 2fa check failed
return false;
}
Expand Down Expand Up @@ -2308,7 +2308,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -2395,7 +2395,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -2466,7 +2466,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === supertokensUserRoles.UserRoleClaim.id) {
if (err.id === supertokensUserRoles.UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -2747,7 +2747,7 @@ const Dashboard = () => {
return null;
}

if (sessionContext.invalidClaims.some(i => i.validatorId === SecondFactorClaim.id)) {
if (sessionContext.invalidClaims.some(i => i.id === SecondFactorClaim.id)) {
// the 2fa check failed. We should redirect the user to the second
// factor screen.
return "You cannot access this page because you have not completed 2FA";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -456,7 +456,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === UserRoleClaim.id) {
if (err.id === UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down Expand Up @@ -527,7 +527,7 @@ async function shouldLoadRoute(): Promise<boolean> {
}

for (const err of validationErrors) {
if (err.validatorId === supertokensUserRoles.UserRoleClaim.id) {
if (err.id === supertokensUserRoles.UserRoleClaim.id) {
// user roles claim check failed
} else {
// some other claim check failed (from the global validators list)
Expand Down
Loading

0 comments on commit c6ba133

Please sign in to comment.