Updated simple-java-mail

This commit is contained in:
neviyn 2020-03-09 13:35:39 +00:00
parent aba1b91eec
commit 216e5f2e82
3 changed files with 6 additions and 5 deletions

View File

@ -122,7 +122,7 @@
<dependency> <dependency>
<groupId>org.simplejavamail</groupId> <groupId>org.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId> <artifactId>simple-java-mail</artifactId>
<version>5.2.0</version> <version>6.0.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlinx</groupId> <groupId>org.jetbrains.kotlinx</groupId>

View File

@ -1,8 +1,9 @@
package uk.co.neviyn.observationdatabase package uk.co.neviyn.observationdatabase
import org.joda.time.DateTime import org.joda.time.DateTime
import org.simplejavamail.api.mailer.Mailer
import org.simplejavamail.api.mailer.config.TransportStrategy
import org.simplejavamail.email.EmailBuilder import org.simplejavamail.email.EmailBuilder
import org.simplejavamail.mailer.Mailer
import org.simplejavamail.mailer.MailerBuilder import org.simplejavamail.mailer.MailerBuilder
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
@ -47,5 +48,5 @@ class Email {
private fun createMailer(): Mailer = MailerBuilder.withSMTPServer(environment.getProperty("smtp.host"), private fun createMailer(): Mailer = MailerBuilder.withSMTPServer(environment.getProperty("smtp.host"),
environment.getProperty("smtp.port")!!.toInt(), environment.getProperty("smtp.username"), environment.getProperty("smtp.port")!!.toInt(), environment.getProperty("smtp.username"),
environment.getProperty("smtp.password")).buildMailer() environment.getProperty("smtp.password")).withTransportStrategy(TransportStrategy.SMTP_TLS).buildMailer()
} }

View File

@ -132,8 +132,8 @@ class ObservationsController {
logger.info("Attempted to add Observation without a tutor") logger.info("Attempted to add Observation without a tutor")
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Observation requires at least one Tutor") throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Observation requires at least one Tutor")
} }
for(scenario in newObservation.scenarios){ for (scenario in newObservation.scenarios) {
if(!scenario.ratingsAllValid()){ if (!scenario.ratingsAllValid()) {
logger.info("Attempted to submit scenario with invalid score, $scenario") logger.info("Attempted to submit scenario with invalid score, $scenario")
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Scenario scores must be between 1 and 5") throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Scenario scores must be between 1 and 5")
} }