fix(platform): sanitize Spring mail test failures
This commit is contained in:
+2
-1
@@ -9,6 +9,7 @@ import com.lab.labtimesheet.feature.integration.model.dto.SmtpForm;
|
||||
import com.lab.labtimesheet.feature.integration.service.SmtpConfigurationService;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
@@ -76,7 +77,7 @@ class SmtpController {
|
||||
try {
|
||||
smtp.testDraft(action.getDraftId(), adminId(principal), principal.getName());
|
||||
return "redirect:/admin/smtp?tested";
|
||||
} catch (IllegalArgumentException | IllegalStateException failure) {
|
||||
} catch (IllegalArgumentException | IllegalStateException | MailException failure) {
|
||||
bindingResult.reject("smtp.test.failed", TEST_FAILURE_MESSAGE);
|
||||
return renderActionError(model, bindingResult);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user