remove unused function, count resent by admin

This commit is contained in:
Moriz Wahl 2022-11-30 14:45:02 +01:00
parent bbd163f1e0
commit 796f5af2c6
2 changed files with 11 additions and 6 deletions

View File

@ -654,6 +654,9 @@ export class AdminResolver {
throw new Error(`The emailContact: ${email} of htis User is deleted.`)
}
emailContact.emailResendCount++
await emailContact.save()
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const emailSent = await sendAccountActivationEmail({
link: activationLink(emailContact.emailVerificationCode),

View File

@ -466,16 +466,16 @@ export class UserResolver {
if (!canEmailResend(user.emailContact.updatedAt || user.emailContact.createdAt)) {
logger.error(
`email already sent less than ${printTimeDuration(
CONFIG.EMAIL_CODE_REQUEST_TIME,
)} minutes ago`,
CONFIG.EMAIL_CODE_REQUEST_TIME,
)} minutes ago`,
)
throw new Error(
`email already sent less than ${printTimeDuration(
CONFIG.EMAIL_CODE_REQUEST_TIME,
)} minutes ago`,
CONFIG.EMAIL_CODE_REQUEST_TIME,
)} minutes ago`,
)
}
user.emailContact.updatedAt = new Date()
user.emailContact.emailResendCount++
user.emailContact.emailVerificationCode = random(64)
@ -498,7 +498,9 @@ export class UserResolver {
/* uncomment this, when you need the activation link on the console */
// In case EMails are disabled log the activation link for the user
if (!emailSent) {
logger.debug(`Reset password link: ${activationLink(user.emailContact.emailVerificationCode)}`)
logger.debug(
`Reset password link: ${activationLink(user.emailContact.emailVerificationCode)}`,
)
}
logger.info(`forgotPassword(${email}) successful...`)