Changed regex to basic email regex
This commit is contained in:
@@ -76,17 +76,8 @@ public class VotingController {
|
|||||||
|
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public String WelcomeSite() {
|
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";
|
return "start.html";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void sendSimpleMessage(String to, String subject, String text) {
|
public void sendSimpleMessage(String to, String subject, String text) {
|
||||||
SimpleMailMessage message = new SimpleMailMessage();
|
SimpleMailMessage message = new SimpleMailMessage();
|
||||||
@@ -98,7 +89,8 @@ public class VotingController {
|
|||||||
|
|
||||||
@RequestMapping("/checkStatus")
|
@RequestMapping("/checkStatus")
|
||||||
public String VerifyName(@RequestParam String name, Model model) {
|
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 {
|
try {
|
||||||
LOGGER.warn(name);
|
LOGGER.warn(name);
|
||||||
Voter voter = voterRepository.findByEmail(name.toLowerCase().strip());
|
Voter voter = voterRepository.findByEmail(name.toLowerCase().strip());
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
function test() {
|
function test() {
|
||||||
let input_field = document.getElementById("email_input");
|
let input_field = document.getElementById("email_input");
|
||||||
let input = input_field.value;
|
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 = "";
|
input_field.value = "";
|
||||||
alert("Die Email-Adresse \"" + input + "\" entspricht nicht den Vorgaben");
|
alert("Die Email-Adresse \"" + input + "\" entspricht nicht den Vorgaben");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user