Added a datelock to end votes automatically

This commit is contained in:
2020-12-27 23:23:41 +01:00
parent ffea848311
commit 11e2906271
2 changed files with 36 additions and 1 deletions
@@ -19,6 +19,8 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.PostConstruct;
import java.time.LocalDate;
import java.time.Month;
import java.util.*;
import java.util.concurrent.ExecutionException;
@@ -85,8 +87,17 @@ public class VotingController {
@RequestMapping("/")
public String WelcomeSite() {
LocalDate finishDate = LocalDate.of(2021, Month.JANUARY,8);
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();
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="de" xmlns:th="https://www.thymeleaf.org/">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link th:href="@{/styles/allreadyVoted.css}" rel="stylesheet" />
</head>
<body class="center-screen">
<div class="centered">
<h1>Das Voting wurde beendet!</h1>
<h2>Informationen zu Votings sind der Adolfinumwebsite zu entnehmen</h2>
<button id="backButton" class="submitButton">Zur Adolfinum Seite</button>
</div>
<script>
document.getElementById("backButton").onclick = function() {
location.href = "https://adolfinum.de";
};
</script>
</body>
</html>