From 216e5f2e82ae0c75de38a2d6c4a942e82cfb9719 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 9 Mar 2020 13:35:39 +0000 Subject: [PATCH] Updated simple-java-mail --- backend/pom.xml | 2 +- .../main/kotlin/uk/co/neviyn/observationdatabase/Email.kt | 5 +++-- .../observationdatabase/controller/ObservationsController.kt | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/pom.xml b/backend/pom.xml index 9299d2d..e1e2154 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -122,7 +122,7 @@ org.simplejavamail simple-java-mail - 5.2.0 + 6.0.3 org.jetbrains.kotlinx diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt index a719b0a..96ab505 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Email.kt @@ -1,8 +1,9 @@ package uk.co.neviyn.observationdatabase 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.mailer.Mailer import org.simplejavamail.mailer.MailerBuilder import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -47,5 +48,5 @@ class Email { private fun createMailer(): Mailer = MailerBuilder.withSMTPServer(environment.getProperty("smtp.host"), environment.getProperty("smtp.port")!!.toInt(), environment.getProperty("smtp.username"), - environment.getProperty("smtp.password")).buildMailer() + environment.getProperty("smtp.password")).withTransportStrategy(TransportStrategy.SMTP_TLS).buildMailer() } \ No newline at end of file diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt index fd1f539..5947153 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/controller/ObservationsController.kt @@ -132,8 +132,8 @@ class ObservationsController { logger.info("Attempted to add Observation without a tutor") throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Observation requires at least one Tutor") } - for(scenario in newObservation.scenarios){ - if(!scenario.ratingsAllValid()){ + for (scenario in newObservation.scenarios) { + if (!scenario.ratingsAllValid()) { logger.info("Attempted to submit scenario with invalid score, $scenario") throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Scenario scores must be between 1 and 5") }