Fix email verification errors

This commit is contained in:
Stan Wohlwend 2024-04-14 09:21:16 +02:00
parent 59a9df90da
commit dbc0381a8a
2 changed files with 4 additions and 4 deletions

View File

@ -20,15 +20,15 @@ export const POST = deprecatedSmartRouteHandler(async (req: NextRequest) => {
});
if (!codeRecord) {
throw new KnownErrors.PasswordResetCodeNotFound();
throw new KnownErrors.EmailVerificationCodeNotFound();
}
if (codeRecord.expiresAt < new Date()) {
throw new KnownErrors.PasswordResetCodeExpired();
throw new KnownErrors.EmailVerificationCodeExpired();
}
if (codeRecord.usedAt) {
throw new KnownErrors.PasswordResetCodeAlreadyUsed();
throw new KnownErrors.EmailVerificationCodeAlreadyUsed();
}
await prismaClient.projectUser.update({

View File

@ -99,7 +99,7 @@ function EmailVerificationSection() {
buttonText={
!user?.primaryEmailVerified ?
emailSent ?
'Email Sent' :
'Email sent!' :
'Send Email'
: undefined
}