Changed regex to basic email regex

This commit is contained in:
2021-02-13 17:49:50 +01:00
parent 5b3b5b35e5
commit 9b4bfec933
2 changed files with 3 additions and 11 deletions

View File

@@ -76,17 +76,8 @@ public class VotingController {
@RequestMapping("/")
public String WelcomeSite() {
LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,24);
LocalDate now = LocalDate.now();
if(now.isAfter(finishDate)){
LOGGER.warn("passed");
return "errors/votingClosed.html";
} else {
LOGGER.warn("in Bounds");
return "start.html";
}
}
public void sendSimpleMessage(String to, String subject, String text) {
SimpleMailMessage message = new SimpleMailMessage();
@@ -98,7 +89,8 @@ public class VotingController {
@RequestMapping("/checkStatus")
public String VerifyName(@RequestParam String name, Model model) {
if (name.strip().toLowerCase().matches("[a-z]+\\.[a-z]+@adolfinum+\\.de$")) {
//Basic email regex
if (name.strip().toLowerCase().matches("[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+")) {
try {
LOGGER.warn(name);
Voter voter = voterRepository.findByEmail(name.toLowerCase().strip());

View File

@@ -18,7 +18,7 @@
function test() {
let input_field = document.getElementById("email_input");
let input = input_field.value;
if (!input.trim().match("[a-z]+\\.[a-z]+@adolfinum+\\.de$")) {
if (!input.trim().match("[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+")) {
input_field.value = "";
alert("Die Email-Adresse \"" + input + "\" entspricht nicht den Vorgaben");
}