Update backend/src/graphql/resolver/UserResolver.ts

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
This commit is contained in:
Hannes Heine 2022-03-16 05:22:40 +01:00 committed by GitHub
parent e5217640e5
commit 623ba8e86b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,7 +490,7 @@ export class UserResolver {
throw new Error('Could not login with emailVerificationCode')
})
// Code is only valid for 10minutes
// Code is only valid for `CONFIG.EMAIL_CODE_VALID_TIME` minutes
const timeElapsed = Date.now() - new Date(optInCode.updatedAt).getTime()
if (timeElapsed > parseInt(CONFIG.EMAIL_CODE_VALID_TIME.toString()) * 60 * 1000) {
throw new Error(`email already sent less than $(CONFIG.EMAIL_CODE_VALID_TIME} minutes ago`)