Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX reset or forgot mails #44

Open
wants to merge 4 commits into
base: newdist
Choose a base branch
from
Open
Changes from 2 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.mycollab.module.user.accountsettings.localization.UserI18nEnum
import com.mycollab.module.user.service.UserService
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Component
import java.util.*

/**
* @author MyCollab Ltd
Expand Down Expand Up @@ -60,16 +61,14 @@ class ResetUserPasswordCommand(private val extMailService: ExtMailService,
contentGenerator.putVariable("urlRecoveryPassword", recoveryPasswordURL)
contentGenerator.putVariable("copyRight", LocalizationHelper.getMessage(locale, MailI18nEnum.Copyright,
DateTimeUtils.getCurrentYear()))
val recipient = MailRecipientField(user.email, user.username)
val recipientFields = listOf(recipient)


extMailService.sendHTMLMail(applicationConfiguration.notifyEmail, applicationConfiguration.siteName,
recipientFields,
Collections.singletonList(MailRecipientField(user.username, user.username)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use listOf instead of Collections.singletonList. of course, both works but I prefer to use the existing Kotlin API in Kotlin source instead of Java library. We can write the code like listOf(MailRecipientField(user.username, user.username))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

LocalizationHelper.getMessage(locale, UserI18nEnum.MAIL_RECOVERY_PASSWORD_SUBJECT,
applicationConfiguration.siteName),
contentGenerator.parseFile("mailUserRecoveryPasswordNotifier.ftl", locale))
} else {
LOG.error("Can not reset the password of username $username because this user is not existed")
}
}
}
}