Merge branch 'testing' into main

This commit is contained in:
2021-01-27 18:28:47 +01:00
32 changed files with 3742 additions and 4333 deletions

3
.gitignore vendored
View File

@@ -3,6 +3,9 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
Databases/
logs/
Results/
### STS ###
.apt_generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,6 @@ import com.github.cato447.AbizeitungVotingSystem.helper.RandomNumber;
import com.github.cato447.AbizeitungVotingSystem.repositories.*;
import com.github.cato447.AbizeitungVotingSystem.table.TableAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller;
@@ -19,22 +18,15 @@ 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.*;
@Controller
public class VotingController {
@Value("motto")
String motto;
@Value("adding")
String adding;
@Value("voting")
String voting;
private boolean votingPhase = false;
private boolean mottoPhase = false;
private boolean addingPhase = false;
private boolean votingPhase;
private boolean addingPhase;
private static final Logger LOGGER = LogManager.getLogger(VotingController.class);
private TableAction tableAction = new TableAction();
@@ -48,9 +40,6 @@ public class VotingController {
@Autowired
CategoryRepository categoryRepository;
@Autowired
MottoRepository mottoRepository;
@Autowired
PossibleCandidateRepository possibleCandidateRepository;
@@ -63,21 +52,10 @@ public class VotingController {
@PostConstruct
public void init() {
if (motto != null){
mottoPhase = true;
} else if (adding != null){
addingPhase = true;
} else if (voting != null){
votingPhase = true;
}
votingPhase = true;
addingPhase = false;
// //TODO: TESTING REMOVE ON SHIPPING
// votingPhase = false;
// mottoPhase = true;
// addingPhase = false;
LOGGER.info("Program started with arguments: votingPhase="+ votingPhase + " mottoPhase=" + mottoPhase + " addingPhase=" + addingPhase);
LOGGER.info("Program started with arguments: votingPhase="+ votingPhase + " addingPhase=" + addingPhase);
if (voterRepository.findAll().size() == 0) {
tableAction.setUpVoters(voterRepository);
@@ -86,14 +64,10 @@ public class VotingController {
if (categoryRepository.findAll().size() == 0) {
tableAction.setUpCategories(categoryRepository);
possibleCandidateRepository.deleteAll();
LOGGER.info("Categories successfully set up");
}
if (mottoRepository.findAll().size() == 0){
tableAction.setUpMottos(mottoRepository);
LOGGER.info("Mottos successfully set up");
}
if (candidateRepository.findAll().size() == 0 && votingPhase == true && possibleCandidateRepository.findAll().size() != 0) {
tableAction.setUpCandidates(possibleCandidateRepository, candidateRepository);
LOGGER.info("Candidates successfully set up");
@@ -102,7 +76,16 @@ public class VotingController {
@RequestMapping("/")
public String WelcomeSite() {
return "start.html";
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) {
@@ -119,18 +102,18 @@ public class VotingController {
try {
LOGGER.warn(name);
Voter voter = voterRepository.findByEmail(name.toLowerCase().strip());
if (voter == null){
LOGGER.error(name + " is not allowed to vote");
return "errors/notRegistered.html";
}
if (voter.getVote_status() && votingPhase) {
LOGGER.warn(name + " has already voted");
return "errors/alreadyVoted.html";
} else if (voter.getCandidatesubmit_status() && addingPhase) {
LOGGER.warn(name + " has already submitted its candidates");
return "errors/alreadysubmittedcandidates.html";
} else if (voter.getMotto_status() && mottoPhase) {
LOGGER.warn(name + " has already chose their motto");
return "errors/alreadyVotedForMotto.html";
return "errors/alreadyVoted.html";
} else {
if (authCodesRepository.findByName(name) == null) {
LOGGER.warn("no code");
AuthCode authCode = tableAction.generateToken(name, RandomNumber.getRandomNumberString(), authCodesRepository);
sendSimpleMessage(name, "Code zur Authentifizierung", "Dein Code lautet: " + authCode.getCode());
} else if (authCodesRepository.findByName(name) != null && authCodesRepository.findByName(name).isExpired()) {
@@ -138,32 +121,38 @@ public class VotingController {
sendSimpleMessage(name, "Code zur Authentifizierung", "Dein Code lautet: " + authCode.getCode());
}
model.addAttribute("name", name);
model.addAttribute("codeTime", authCodesRepository.findByName(name).getExpirationTime());
model.addAttribute("codeExpired", false);
model.addAttribute("codeFalse", false);
return "authenticate.html";
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.error(name + " is not allowed to vote");
return "errors/notRegistered.html";
tableAction.deleteToken(name, authCodesRepository);
return "error.html";
}
} else {
return "errors/falseInput.html";
}
}
@RequestMapping("/newCode")
public String provideNewCode(@RequestParam String name, Model model){
AuthCode authCode = tableAction.generateToken(name, RandomNumber.getRandomNumberString(), authCodesRepository);
sendSimpleMessage(name, "Code zur Authentifizierung", "Dein Code lautet: " + authCode.getCode());
model.addAttribute("name", name);
model.addAttribute("codeTime", authCodesRepository.findByName(name).getExpirationTime());
model.addAttribute("codeExpired", false);
model.addAttribute("codeFalse", false);
return "authenticate.html";
}
@RequestMapping("/vote")
public String voting_adding(@RequestParam String code, @RequestParam String name, Model model) {
String tokenStatus = tableAction.checkToken(name, code, authCodesRepository);
if (tokenStatus.equals("matched")) {
LOGGER.warn("matched");
if (mottoPhase) {
List<Motto> mottos = mottoRepository.findAll();
model.addAttribute("mottos", mottos);
model.addAttribute("name", name);
return "mottoVoting.html";
} else if (addingPhase) {
if (addingPhase) {
PossibleCandidateWrapper possibleCandidates = new PossibleCandidateWrapper();
List<Category> categories = categoryRepository.findAll();
for (int i = 0; i < categories.size(); i++) {
@@ -197,7 +186,7 @@ public class VotingController {
@RequestMapping("/saveCandidates")
public String candidateSaving(@ModelAttribute PossibleCandidateWrapper possibleCandidates, @RequestParam String name) {
if (voterRepository.findByEmail(name).getVote_status()) {
if (voterRepository.findByEmail(name).getCandidatesubmit_status()) {
return "errors/alreadyVoted.html";
} else {
LinkedList<PossibleCandidate> posCandidates = possibleCandidates.getPossibleCandidates();
@@ -208,42 +197,55 @@ public class VotingController {
PossibleCandidate p = possibleCandidateRepository.findByNameAndCategory(posCandidate.getName(), categoryRepository.findById(index).get());
p.setVotes(p.getVotes() + 1);
possibleCandidateRepository.save(p);
} else if (possibleCandidateRepository.findByNameAndCategory(posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length-1], categoryRepository.findById(index).get()) != null){
PossibleCandidate p = possibleCandidateRepository.findByNameAndCategory(posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length-1], categoryRepository.findById(index).get());
p.setVotes(p.getVotes() + 1);
possibleCandidateRepository.save(p);
} else {
PossibleCandidate possibleCandidate = new PossibleCandidate(posCandidate.getName(), categoryRepository.findById(index).get());
possibleCandidateRepository.save(possibleCandidate);
if (index > 31 && posCandidate.getName().indexOf(" ") != -1) {
if (posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length-1].equals("Neumann") ||
posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length-1].equals("neumann") ||
posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length-1].equals("Mecklenburg") ||
posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length-1].equals("mecklenburg")){
PossibleCandidate possibleCandidate = new PossibleCandidate(posCandidate.getName(), categoryRepository.findById(index).get());
possibleCandidateRepository.save(possibleCandidate);
} else {
posCandidate.setName(posCandidate.getName().split(" ")[posCandidate.getName().split(" ").length - 1]);
PossibleCandidate possibleCandidate = new PossibleCandidate(posCandidate.getName(), categoryRepository.findById(index).get());
possibleCandidateRepository.save(possibleCandidate);
}
} else {
PossibleCandidate possibleCandidate = new PossibleCandidate(posCandidate.getName(), categoryRepository.findById(index).get());
possibleCandidateRepository.save(possibleCandidate);
}
}
}
index++;
}
tableAction.updateCandidatesubmit_status(name, voterRepository);
return "candidateAddingSuccessful.html";
}
}
@RequestMapping("/saveMotto")
public String mottoSaving(@RequestParam String name, @RequestParam String voteValue) {
LOGGER.info(name);
if (voterRepository.findByEmail(name).getMotto_status()) {
return "errors/alreadySubmitted.html";
} else {
tableAction.voteForMotto(voteValue, mottoRepository);
tableAction.updateMottoStatus(name, voterRepository);
LOGGER.info(name + " has choose his motto");
tableAction.updateCandidatesubmit_status(name, voterRepository);
return "voteSuccessful.html";
}
return "voteSuccessful.html";
}
@RequestMapping("/processVote")
public String ProcessVote(@RequestParam String name, @RequestParam String voteValues) {
if (voterRepository.findByEmail(name).getCandidatesubmit_status()) {
return "errors/alreadySubmitted.html";
if (voterRepository.findByEmail(name).getVote_status()) {
return "errors/alreadyVoted.html";
} else {
String[] partVoteValues = voteValues.split(",");
for (String s : partVoteValues) {
LinkedList<String> voteFor = new LinkedList<>();
if(!voteValues.equals("")) {
String[] partVoteValues = voteValues.split(",");
for (String s : partVoteValues) {
voteFor.add(s);
}
LOGGER.info(name + " has voted!");
}
for (String s: voteFor) {
tableAction.voteForCandidate(s, candidateRepository);
}
tableAction.updateVotingStatus(name, voterRepository);
LOGGER.info(name + " has voted!");
return "voteSuccessful.html";
}
}

View File

@@ -37,8 +37,12 @@ public class AuthCode {
return time;
}
public long getExpirationTime(){
return time + 1800*1000;
}
public boolean isExpired(){
return System.currentTimeMillis() >= (time + 600*1000);
return System.currentTimeMillis() >= (time + 1800*1000);
}
public void setTime(long time) {

View File

@@ -1,58 +0,0 @@
package com.github.cato447.AbizeitungVotingSystem.entities;
import javax.persistence.*;
@Entity
@Table(name = "mottos")
public class Motto implements Comparable<Motto>{
public Motto() {
super();
}
public Motto(String name) {
super();
this.name = name;
this.votes = 0;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private Integer votes;
public Long getId() {
return id;
}
public String getName() {
return name;
}
public Integer getVotes() {
return votes;
}
public void setName(String name) {
this.name = name;
}
public void setVotes(Integer votes) {
this.votes = votes;
}
public void voteFor() {
this.votes += 1;
}
@Override
public int compareTo(Motto m) {
if (getVotes() == null || m.getVotes() == null) {
return 0;
}
return m.getVotes().compareTo(getVotes());
}
}

View File

@@ -14,7 +14,6 @@ public class Voter {
this.email = email;
this.vote_status = false;
this.candidatesubmit_status = false;
this.motto_status = false;
}
@Id
@@ -22,7 +21,6 @@ public class Voter {
private Long id;
private String email;
private Boolean vote_status;
private Boolean motto_status;
private Boolean candidatesubmit_status;
public Long getId() {
@@ -41,10 +39,6 @@ public class Voter {
return candidatesubmit_status;
}
public Boolean getMotto_status() {
return motto_status;
}
public void vote(){
vote_status = true;
}
@@ -52,6 +46,4 @@ public class Voter {
public void submitCandidates() {
candidatesubmit_status = true;
}
public void voteMotto() { motto_status = true;}
}

View File

@@ -1,14 +0,0 @@
package com.github.cato447.AbizeitungVotingSystem.repositories;
import com.github.cato447.AbizeitungVotingSystem.entities.Motto;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface MottoRepository extends JpaRepository<Motto, Integer> {
public Motto findByName(String name);
Optional<Motto> findById(Long id);
}

View File

@@ -1,16 +1,9 @@
package com.github.cato447.AbizeitungVotingSystem.table;
import com.github.cato447.AbizeitungVotingSystem.controller.VotingController;
import com.github.cato447.AbizeitungVotingSystem.entities.*;
import com.github.cato447.AbizeitungVotingSystem.repositories.*;
import org.aspectj.weaver.loadtime.definition.LightXMLParser;
import java.io.*;
import java.lang.reflect.Array;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.Buffer;
import java.util.*;
public class TableAction {
@@ -31,12 +24,6 @@ public class TableAction {
voterRepository.save(voter);
}
public void updateMottoStatus(String email, VoterRepository voterRepository){
Voter voter = voterRepository.findByEmail(email);
voter.voteMotto();
voterRepository.save(voter);
}
public AuthCode generateToken(String name, String code, AuthCodesRepository authCodesRepository) {
AuthCode authCode = new AuthCode(name, code);
try{
@@ -67,12 +54,12 @@ public class TableAction {
return "wrong";
}
private boolean fiveMinutesPassed(Long time){
return System.currentTimeMillis() >= (time + 300*1000);
public void deleteToken(String name, AuthCodesRepository authCodesRepository){
authCodesRepository.delete(authCodesRepository.findByName(name));
}
private int getLimit(List<PossibleCandidate> possibleCandidates){
return possibleCandidates.size() <= 5 ? possibleCandidates.size() : 5;
return possibleCandidates.size() <= 15 ? possibleCandidates.size() : 15;
}
public void voteForCandidate(String id, CandidateRepository candidateRepository){
@@ -82,15 +69,8 @@ public class TableAction {
candidateRepository.save(candidate);
}
public void voteForMotto(String id, MottoRepository mottoRepository){
long mottoID = Long.valueOf(id);
Motto motto = mottoRepository.findById(mottoID).get();
motto.voteFor();
mottoRepository.save(motto);
}
public void setUpVoters(VoterRepository voterRepository){
try (InputStream inputStream = getClass().getResourceAsStream("/Q2_emails.txt");
try (InputStream inputStream = getClass().getResourceAsStream("/Email_Whitelist.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line = "";
ArrayList<Voter> voters = new ArrayList<Voter>();
@@ -119,8 +99,17 @@ public class TableAction {
Collections.sort(possibleCandidatesPerCategory, Comparator.comparing(PossibleCandidate::getVotes));
Collections.reverse(possibleCandidatesPerCategory);
for (int j = 0; j < getLimit(possibleCandidatesPerCategory); j++){
Candidate candidate = new Candidate(possibleCandidatesPerCategory.get(j).getName(), possibleCandidatesPerCategory.get(j).getCategory());
candidateRepository.save(candidate);
if (j >= 10 && possibleCandidatesPerCategory.get(j).getVotes() == possibleCandidatesPerCategory.get(9).getVotes()){
Candidate candidate = new Candidate(possibleCandidatesPerCategory.get(j).getName(), possibleCandidatesPerCategory.get(j).getCategory());
candidateRepository.save(candidate);
}
if (j < 10){
Candidate candidate = new Candidate(possibleCandidatesPerCategory.get(j).getName(), possibleCandidatesPerCategory.get(j).getCategory());
candidateRepository.save(candidate);
}
if (j == 14){
break;
}
}
i += -1;
possibleCandidatesPerCategory.clear();
@@ -147,20 +136,4 @@ public class TableAction {
e.printStackTrace();
}
}
public void setUpMottos(MottoRepository mottoRepository){
try (InputStream inputStream = getClass().getResourceAsStream("/Mottos.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line = "";
ArrayList<Motto> mottos = new ArrayList<>();
while ((line = reader.readLine())!= null){
String name = line;
Motto motto = new Motto(name);
mottos.add(motto);
}
mottoRepository.saveAll(mottos);
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -1,36 +0,0 @@
Wer wird nie von zuhause ausziehen?
Wer ist der/die kreativste Zuspätkommer/in?
Mit wem wird man am ehesten in der Zukunft angeben zur Schule gegangen zu sein?
Wer wohnt im Fittnessstudio? (Schüler)
Wer ist der coolste Leherer?
Wer ist die coolste Lehrerin?
Wer macht den besten Matheunterricht?
Welcher Lehrer hat den Beruf verfehlt?
Welcher Lehrer ist nie da?
Wer hat das Internet erfunden?
Wer sponsort Schollin? (Schüler)
Wer ist am engagiertesten? (Schüler)
Wer wird Bundeskanzler? (Schüler)
Wer hat das Kimpeltum gegründet? (Schüler)
Wer saß am längsten im Klassenschrank? (Schüler)
Wer hat die gößte Sauklaue? (Leherer)
Wer gründet das nächste Google? (Schüler)
Wer kommt am schnellsten in den Knast? (Schüler)
Top 3-Pärchen? (Schüler)
Top 3 Lehrergespanne? (Schüler)
Wer ist der motiviertester Lehrer?
Wer ist Google auf zwei Beinen(Schüler)?
Wer hat den besten Style (Schüler)?
Wer hat den besten Style (Lehrer)?
Wer währe ein gutes Pärchen (Lehrer)?
Wer trinkt am meisten Kaffe (Schüler)?
Wer trinkt am meisten Kaffe (Lehrer)?
Tischflip?
Wer wird Harzer?
Wer hat Wiedererkennungswert (Schüler)?
Wen erkennt man an der Lache (Schüler)?
Wer bringt die dümmsten Witze? (Lehrer)
Wer hat den meisten Schwachsinn erzählt? (Lehrer)
Welche Lehrer machen nie das, was die Schüler wollten? (Lehrer)
Wer isst immer? (Lehrer)
Wer hat die meisten peinlichen Momente gebracht?

View File

View File

@@ -1,11 +0,0 @@
CannABIs - wir haben es durchgezogen!
ABI 2,010 ‰ - Meist dichter als Denker
KABItän Blaubär - Immer blau und trotzdem schlau
HABI Potter - Wir verlassen die Kammer des Schreckens
A BItch - Für einen Punkt tue ich alles!
ABIthur - Wenn das Elite von die Gymnahsium gehen tut
LABIrinth - Planlos zum Ziel
ABIcrombie & Fitch - Models gehen, Elche bleiben (Abercrombie & Fitch)
SemipermeABIlität - Nur die Besten kommen durch
KohlrABI - Wir machen uns vom Acker
ABIgasmus - Aber das war nur das Vorspiel

View File

@@ -1,156 +0,0 @@
negar.barzegar@adolfinum.de
simon.berger@adolfinum.de
nicolas.cunha@adolfinum.de
joline.hackstein@adolfinum.de
philip.heckhoff@adolfinum.de
simon.hormes@adolfinum.de
benjamin.vogt@adolfinum.de
taycan.arslan@adolfinum.de
luca.boom@adolfinum.de
leon.borgerding@adolfinum.de
lukas.boy@adolfinum.de
lukas.corell@adolfinum.de
cedric.damerow@adolfinum.de
amelie.david@adolfinum.de
zeynep.efe@adolfinum.de
melinda.hirschelmann@adolfinum.de
lars.hogardt@adolfinum.de
malin.kalnins@adolfinum.de
victor.kocksnchez@adolfinum.de
kamil.kowalczyk@adolfinum.de
romyna.gurny@adolfinum.de
noelia.kocksnchez@adolfinum.de
lili.schweitzer@adolfinum.de
jerome.laukamp@adolfinum.de
elisa.bahl@adolfinum.de
lisa.baumeister@adolfinum.de
johanna.boeckmann@adolfinum.de
svenja.fischer@adolfinum.de
lena.goehlich@adolfinum.de
paula.haub@adolfinum.de
daria.horstmann@adolfinum.de
melina.kascha@adolfinum.de
pia.kleinwegen@adolfinum.de
lauramarie.koenig@adolfinum.de
yarkin.kulaksiz@adolfinum.de
amelie.laake@adolfinum.de
noemi.malaponti@adolfinum.de
yara.mueser@adolfinum.de
paul.nowack@adolfinum.de
luca.ofiera@adolfinum.de
timo.otto@adolfinum.de
linnea.paulukuhn@adolfinum.de
isabelle.schneider@adolfinum.de
nico.scholzen@adolfinum.de
manon.schroff@adolfinum.de
carlotta.tueckmantel@adolfinum.de
simon.bussmann@adolfinum.de
luis.erpenbach@adolfinum.de
meret.fass@adolfinum.de
anna.feldmann@adolfinum.de
alina.fuenderich@adolfinum.de
joline.gilles@adolfinum.de
karolina.hein@adolfinum.de
robin.heldt@adolfinum.de
annika.koch@adolfinum.de
dusanka.djukanovic@adolfinum.de
aaron.glos@adolfinum.de
ayseguel.guelten@adolfinum.de
hamza.hasoumi@adolfinum.de
evelyn.hofmann@adolfinum.de
burakmustafa.kulac@adolfinum.de
dominik.kwitowski@adolfinum.de
julia.lener@adolfinum.de
paula.may@adolfinum.de
luca.mueller@adolfinum.de
mathieu.mueller@adolfinum.de
marie.puetter@adolfinum.de
hendrik.herffs@adolfinum.de
greta.bentgens@adolfinum.de
sven.mittmann@adolfinum.de
jan.hoevel@adolfinum.de
tim.krichel@adolfinum.de
milo.lehnen@adolfinum.de
lewis.lehner@adolfinum.de
nico.lipinski@adolfinum.de
luise.lu@adolfinum.de
maike.nawarotzky@adolfinum.de
rabea.peters@adolfinum.de
patrick.preuss@adolfinum.de
julius.preusser@adolfinum.de
marie.scheidung@adolfinum.de
lena.schlayer@adolfinum.de
emma.sprenger@adolfinum.de
klaudia.kapala@adolfinum.de
gabriel.schacht@adolfinum.de
delia.schmitz@adolfinum.de
katharina.schmitz@adolfinum.de
laurin.severith@adolfinum.de
julian.sievers@adolfinum.de
anna.siewert@adolfinum.de
chiara.welter@adolfinum.de
kira.winzen@adolfinum.de
tim.zentzis@adolfinum.de
justus.boesken@adolfinum.de
finia.brinkmann@adolfinum.de
anesa.cavcic@adolfinum.de
antonia.eigemann@adolfinum.de
nico.hahn@adolfinum.de
timo.kohlmann@adolfinum.de
alexander.kupillas@adolfinum.de
alexander.neumann@adolfinum.de
sophie.osterloh@adolfinum.de
clemens.palinsky@adolfinum.de
oliver.palinsky@adolfinum.de
hendrik.pierlo@adolfinum.de
lilly.schmidtke@adolfinum.de
mara.spicker@adolfinum.de
anhtrung.vo@adolfinum.de
ben.schwarz@adolfinum.de
luca.urbanczyk@adolfinum.de
helena.neukirch@adolfinum.de
nikita.lauff@adolfinum.de
jennifer.lengard@adolfinum.de
julia.mueller@adolfinum.de
philipp.nothers@adolfinum.de
judith.oppenberg@adolfinum.de
dilan.oeztuerk@adolfinum.de
malo.soulier@adolfinum.de
mery.stern@adolfinum.de
nouel.verberkt@adolfinum.de
leon.viktora@adolfinum.de
pia.anthes@adolfinum.de
eray.arici@adolfinum.de
christian.beutel@adolfinum.de
mara.blanke@adolfinum.de
lilly.ventzke@adolfinum.de
luzi.weichert@adolfinum.de
moritz.weihnacht@adolfinum.de
leony.wittmann@adolfinum.de
annika.lieblang@adolfinum.de
leonie.wallusch@adolfinum.de
felix.kirsten@adolfinum.de
moritz.liebisch@adolfinum.de
christian.pickardt@adolfinum.de
jan.schliekmann@adolfinum.de
elsa.piplack@adolfinum.de
jolan.gerritzen@adolfinum.de
lorena.garau@adolfinum.de
matthias.karl@adolfinum.de
justin.kauschke@adolfinum.de
leonie.kramer@adolfinum.de
laura.kurreck@adolfinum.de
maya.lueck@adolfinum.de
sean.mccormick-silex@adolfinum.de
tim.mueller@adolfinum.de
lana.peric@adolfinum.de
jan.pintostrohhaeusl@adolfinum.de
laura.ruettershoff@adolfinum.de
charlotte.schirmer@adolfinum.de
lavinia.schmitz@adolfinum.de
victor.schroers@adolfinum.de
gerrit.schulz@adolfinum.de
clemens.spoo@adolfinum.de
simon.stavroulakis@adolfinum.de
ioannis.boerner@adolfinum.de
marwa.nafouti@adolfinum.de

View File

@@ -1,6 +1,6 @@
spring.datasource.url=jdbc:mysql://localhost/VotingSystem
spring.datasource.username=bitecoding
spring.datasource.password=Cr@ckTh15
spring.datasource.url=jdbc:mysql://hostadress/database
spring.datasource.username=mysql_username
spring.datasource.password=mysql_password
spring.jpa.hibernate.ddl-auto=update
@@ -8,11 +8,11 @@ spring.jpa.hibernate.ddl-auto=update
server.port = 8000
######Email Properties ######
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.host=
spring.mail.port=
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.username=adolfinumvoting@gmail.com
spring.mail.password=Voting2021
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.connectiontimeout=5000

View File

@@ -20,15 +20,19 @@ body {
}
h1 {
margin-top: 5%;
color: #FFF;
margin-bottom: 5%;
}
h2.categoryHeader {
h2 {
color: #FFF;
}
h2.categoryCategory {
color: #bb1515;
margin-top: 5%;
margin-bottom: 1%;
}
input {
background: #bb1515b2;
border: none;
@@ -41,7 +45,6 @@ input {
.submitButton {
margin-top: 5%;
margin-bottom: 5%;
border: 0;
outline: 0;
background: #bb1515;

View File

@@ -0,0 +1,51 @@
body {
background-color: rgb(44, 49, 54);
font-family: Arial, Helvetica, sans-serif;
}
.center-screen {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.centered {
background: transparent;
margin: 0 auto;
padding: 20px;
width: 100%;
overflow: auto;
}
h1 {
color: #FFF;
font-size: 75px;
}
h2 {
color: #6d6d78;
}
.submitButton {
padding: .25em 0;
border: 0;
outline: 0;
background: #bb1515;
color: rgba(255, 255, 255, 0.85);
font-size: 2rem;
width: 500px;
letter-spacing: .0625rem;
border-radius: 12px;
box-shadow: 0 3px 5px 1px rgba(0, 0, 0, 0.25);
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
html,
body {
width: 100%;
height: 100%;
background-image: linear-gradient(to bottom right, #111E25 0%, #111 100%);
font-family: 'Lato', sans-serif;
}

View File

@@ -21,9 +21,12 @@ body {
}
h1 {
margin-top: 5%;
color: #FFF;
margin-bottom: 5%;
}
h1.end {
color: #6d6d78;
margin-bottom: 2%;
}
h2 {
@@ -41,7 +44,7 @@ input {
.submitButton {
margin-top: 5%;
margin-bottom: 5%;
margin-bottom: 1%;
border: 0;
outline: 0;
background: #bb1515;
@@ -54,6 +57,19 @@ input {
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
.newCode {
border: 0;
outline: 0;
background: #bb1515;
color: rgba(255, 255, 255, 0.85);
font-size: 1rem;
width: 250px;
letter-spacing: .0625rem;
border-radius: 12px;
box-shadow: 0 3px 5px 1px rgba(0, 0, 0, 0.25);
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
.errorCode {
margin-top: 10%;
color: #bb1515;

View File

@@ -14,28 +14,6 @@ div.userLogin {
transform: translate(-50%, -50%);
}
input.email_input {
background-color: transparent;
border: transparent;
border-bottom: 2px solid red;
color: #FFF;
font-size: xx-large;
width: fit-content;
}
input.password_input {
background-color: transparent;
border: transparent;
color: #FFF;
font-size: medium;
width: fit-content;
}
label {
color: #FFF;
display: block;
}
#signup_button {
display: block;
margin: auto;
@@ -52,8 +30,24 @@ label {
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
@media only screen and (max-device-width: 1024px) {
input.email_input {
font-size: large;
}
input.email_input {
background-color: transparent;
border: transparent;
border-bottom: 2px solid #bb1515;
color: #FFF;
font-size: xx-large;
width: 500px;
}
input.password_input {
background-color: transparent;
border: transparent;
color: #FFF;
font-size: medium;
width: fit-content;
}
label {
color: #FFF;
display: block;
}

View File

@@ -0,0 +1,54 @@
body {
background-color: rgb(44, 49, 54);
font-family: Arial, Helvetica, sans-serif;
}
.center-screen {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.centered {
background: transparent;
margin: 0 auto;
padding: 20px;
width: 100%;
overflow: auto;
}
h1 {
color: #FFF;
}
h2 {
color: #FFF;
}
h2.time_remain {
color: #6d6d78;
}
.submitButton {
padding: .25em 0;
border: 0;
outline: 0;
background: #bb1515;
color: rgba(255, 255, 255, 0.85);
font-size: 2rem;
width: 500px;
letter-spacing: .0625rem;
border-radius: 12px;
box-shadow: 0 3px 5px 1px rgba(0, 0, 0, 0.25);
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
html,
body {
width: 100%;
height: 100%;
background-image: linear-gradient(to bottom right, #111E25 0%, #111 100%);
font-family: 'Lato', sans-serif;
}

View File

@@ -42,7 +42,8 @@ button {
}
.submitButton {
margin-top: 5%;
margin-top: 2%;
margin-bottom: 5%;
padding: .25em 0;
border: 0;
outline: 0;
@@ -56,6 +57,23 @@ button {
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
@media only screen and (max-device-width: 480px) {
.submitButton {
margin-top: 2%;
padding: .25em 0;
border: 0;
outline: 0;
background: rgb(6, 216, 136);
color: rgba(255, 255, 255, 0.85);
font-size: 2rem;
width: 500px;
letter-spacing: .0625rem;
border-radius: 12px;
box-shadow: 0 3px 5px 1px rgba(0, 0, 0, 0.25);
text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.2);
}
}
html,
body {
width: 100%;

View File

@@ -28,7 +28,7 @@
$('#inputForm div.group:nth-child(' + q + ')').hide();
$('#inputForm div.group:nth-child(' + (q + 1) + ')').show();
if (q == (qMax - 1)) {
$('#btnNext').html('Submit Answers');
$('#btnNext').html('Eingabe bestätigen');
}
q++;
} else {
@@ -42,11 +42,17 @@
<form id="inputForm" action="#" th:action="@{/saveCandidates}" th:object="${form}" method="post">
<div id="candidateAdding">
<div class="group" th:each="category, itemStat : ${categories}">
<div th:if="${itemStat.index > 30}">
<h2 class="categoryCategory">Lehrer</h2>
</div>
<div th:unless="${itemStat.index > 30}">
<h2 class="categoryCategory">Schüler</h2>
</div>
<h2 class="categoryHeader" th:text="${category.name}"></h2>
<input th:field="*{possibleCandidates[__${itemStat.index}__].name}"/>
<input th:field="*{possibleCandidates[__${itemStat.index}__].name}" />
</div>
</div>
<button class="submitButton" id="btnNext" type="submit">Nächste Frage</button>
<button class="submitButton" id="btnNext" type="submit">Nächste Kategorie</button>
<input id="voterName" type="hidden" name="name" th:value="${name}" />
</form>
</div>

View File

@@ -10,14 +10,9 @@
<body class="center-screen">
<script>
var scale = Math.min(
availableWidth / contentWidth,
availableHeight / contentHeight
);
</script>
<h1 th:text="|Dir wurde ein Code an ${name} gesendet!|"></h1>
<h1>Nicht wundern das kann ein wenig dauern!</h1>
<h1 id="time_remain" class="end" th:text="${codeTime}"></h1>
<h2>Bitte gebe den Authentifizierungscode ein</h2>
<form action="#" id="passForm" th:action="@{/vote}" method="post">
<input id="voterName" type="hidden" name="name" th:value="${name}" />
@@ -28,11 +23,18 @@
<input type="text" placeholder="•" class="passInput" name="pass[]" maxlength="1" autocomplete="off" required pattern="\d{1}">
<input type="text" placeholder="•" class="passInput" name="pass[]" maxlength="1" autocomplete="off" required pattern="\d{1}">
<input type="text" placeholder="•" class="passInput" name="pass[]" maxlength="1" autocomplete="off" required pattern="\d{1}">
</form>
<button class="submitButton" id="signup_button" onclick="getCode()">Abstimmen</button>
<form action="#" th:action="@{/newCode}" method="post">
<input id="voterName" type="hidden" name="name" th:value="${name}" />
<button class="newCode">Neuen Code anfordern</button>
</form>
<div th:if="${codeExpired}">
<h2 class="errorCode">Der Code ist nicht mehr gültig!<br>Fordere einen neuen an</h2>
<h2 class="errorCode">Der Code ist nicht mehr gültig!</h2>
</div>
<div th:if="${codeFalse}">
@@ -76,6 +78,33 @@
output.value = code;
document.getElementById("passForm").submit();
}
function updateCounter(time) {
const zeroPad = (num, places) => String(num).padStart(places, '0')
// Show time remaining now.
showTimeRemaining();
var dateFuture = time;
console.log(dateFuture);
// Set a timer to update the displayed clock every 1000 milliseconds.
var updateTimeLoop = setInterval(showTimeRemaining, 1000);
function showTimeRemaining() {
var dateNow = Date.now();
var days = zeroPad(Math.floor((dateFuture - dateNow) / (1000 * 60 * 60 * 24)), 2);
var hours = zeroPad(Math.floor(((dateFuture - dateNow) - days * 1000 * 60 * 60 * 24) / (1000 * 60 * 60)), 2);
var mins = zeroPad(Math.floor(((dateFuture - dateNow) - days * 1000 * 60 * 60 * 24 - hours * 1000 * 60 * 60) / (1000 * 60)), 2);
var secs = zeroPad(Math.floor(((dateFuture - dateNow) - days * 1000 * 60 * 60 * 24 - hours * 1000 * 60 * 60 - mins * 1000 * 60) / 1000), 2);
document.getElementById("time_remain").innerHTML = "Der Code gilt noch für " + mins + ":" + secs;
if (hours + mins + secs == 0) {
document.getElementById("time_remain").innerHTML = "Der Code ist abgelaufen";
}
}
}
updateCounter(document.getElementById("time_remain").innerHTML);
</script>
</body>

View File

@@ -1,10 +1,24 @@
<!DOCTYPE html>
<html>
<html lang="de" xmlns:th="https://www.thymeleaf.org/">
<body>
<h1>Something went wrong! </h1>
<h2>Our Engineers are on it</h2>
<a href="/">Go Home</a>
<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>Oops irgendwas ist kaputt gegangen</h1>
<h2 id="time_remain">Keine Sorge! <br> Probiers nochmal :D</h2>
<button id="backButton" class="submitButton">Zurück zum Anfang</button>
</div>
<script>
document.getElementById("backButton").onclick = function() {
location.href = "/";
};
</script>
</body>
</html>

View File

@@ -3,12 +3,21 @@
<head>
<meta charset="UTF-8">
<title>Abizeitung 2020/2021 Voting</title>
<title>Title</title>
<link th:href="@{/styles/allreadyVoted.css}" rel="stylesheet" />
</head>
<body>
<h1 style="color: red;"> Jeder darf nur einmal abstimmen! </h1>
<a href="/">Return to Login-Site</a>
<body class="center-screen">
<div class="centered">
<h1>Du hast schon abgestimmt!</h1>
<button id="backButton" class="submitButton">Zurück zum Anfang</button>
</div>
<script>
document.getElementById("backButton").onclick = function() {
location.href = "/";
};
</script>
</body>
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="de" xmlns:th="https://www.thymeleaf.org/">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 style="color: red;">Du hast deine Motto schon gewählt!</h1>
<a href="/">Return to Login-Site</a>
</body>
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="de" xmlns:th="https://www.thymeleaf.org/">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 style="color: red;">Du hast deine Kandidaten schon vorgeschlagen!</h1>
<a href="/">Return to Login-Site</a>
</body>
</html>

View File

@@ -1,14 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<html lang="de" xmlns:th="https://www.thymeleaf.org/">
<head>
<meta charset="UTF-8">
<title>Abizeitung 2020/2021 Voting</title>
<title>Title</title>
<link th:href="@{/styles/allreadyVoted.css}" rel="stylesheet" />
</head>
<body>
<h1> Überprüfe noch einmal die eingegebene E-Mail Adresse Sollte der Fall eintreten, dass du deine E-Mail Adresse richtig eingegeben hast und du Schüler der Q2 bist, schreibe eine Mail an simon.bussmann@adolfinum.de mit dem Betreff LoginFehler</h1>
<a href="/">Return to Login-Site</a>
<body class="center-screen">
<div class="centered">
<h1>Du bist nicht zur Wahl zugelassen!</h1>
<h2 id="time_remain">Falls du abstimmen können solltest <br> schreibe eine Mail an adolfinumvoting@gmail.com</h2>
<button id="backButton" class="submitButton">Zurück zum Anfang</button>
</div>
<script>
document.getElementById("backButton").onclick = function() {
location.href = "/";
};
</script>
</body>
</html>

View File

@@ -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>Du bist leider zu spät</h1>
<h2>Momentan ist hier auf der Seite nichts los</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>

View File

@@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="de-DE" xmlns:th="http://thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Abizeitung 2020/2021 Voting</title>
<link th:href="@{/styles/first.css}" rel="stylesheet" />
</head>
<body>
<h2>Paragraphes</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<h2>Links</h2>
<a href="https://www.w3schools.com">This is a link</a>
<h2>HTML Images</h2>
<p>HTML images are defined with the img tag:</p>
<img src="https://www.lifewire.com/thmb/-27LpEPPTgNRUORa_mIczKDkWh0=/1280x905/filters:fill(auto,1)/what-is-binary-and-how-does-it-work-4692749-1-1eaec2e636424e71bb35419ef8d5005b.png" alt="Binary example picture" width="400" height="400">
<h2>Line breaks</h2>
<p>This is a <br> paragraph with a line break.</p>
<h2>Styling</h2>
<p style="color:red;">This is a red paragraph.</p>
<h2>Title attribute</h2>
<p title="I'm a tooltip">This is a paragraph.</p>
<h2>Quotes in attributes</h2>
<p title='John "ShotGun" Nelson'>Example 1</p>
<p title="John 'ShotGun' Nelson">Example 2</p>
<h2>Bigger headings</h2>
<h1>Heading 1</h1>
<h2>HTML Display</h2>
<p>
This paragraph contains a lot of lines in the source code, but the browser ignores it.
</p>
<p>
This paragraph contains a lot of spaces in the source code, but the browser ignores it.
</p>
<h2>Poem Problem</h2>
<p>
My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the ocean. Oh, bring back my Bonnie to me.
</p>
<h5>Solution:</h5>
<pre>
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.
Oh, bring back my Bonnie to me.
</pre>
</body>
</html>

View File

@@ -1,10 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<html lang="de" xmlns:th="http://thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link th:href="@{/styles/voteSuccessful.css}" rel="stylesheet" />
</head>
<body>
<body class="center-screen">
<div class="centered">
<h1>Deine Auswahl fließt nun in die Wahl ein!</h1>
<h2>Danke fürs abstimmen!</h2>
<button id="backButton" class="submitButton">Zurück zum Anfang</button>
</div>
</body>
<script>
document.getElementById("backButton").onclick = function() {
location.href = "/";
};
</script>
</html>

View File

@@ -62,7 +62,7 @@
$('#votingButtons div.voteDiv:nth-child(' + q + ')').hide();
$('#votingButtons div.voteDiv:nth-child(' + (q + 1) + ')').show();
if (q == (qMax - 1)) {
$('#btnNext').html('Submit Answers');
$('#btnNext').html('Auswahl bestätigen');
}
q++;
} else {
@@ -81,7 +81,7 @@
</div>
</div>
</div>
<button class="submitButton" id="btnNext" type="submit">Nächste Frage</button>
<button class="submitButton" id="btnNext" type="submit">Nächste Kategorie</button>
<form action="#" th:action="@{/processVote}" method="post" id="myForm">
<input id="voteValues" type="hidden" name="voteValues" value="" />
<input id="voterName" type="hidden" name="name" th:value="${name}" />