diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ced58f4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.4.RELEASE + + + com.github.cato447 + AbizeitungVotingSystem + 0.0.1-SNAPSHOT + AbizeitungVotingSystem + A Voting System to get voting information for our graduating book + + + 11 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + mysql + mysql-connector-java + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/AbizeitungVotingSystemApplication.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/AbizeitungVotingSystemApplication.java new file mode 100644 index 0000000..f6d55d4 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/AbizeitungVotingSystemApplication.java @@ -0,0 +1,15 @@ +package com.github.cato447.AbizeitungVotingSystem; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +@EnableJpaRepositories +public class AbizeitungVotingSystemApplication { + + public static void main(String[] args) { + SpringApplication.run(AbizeitungVotingSystemApplication.class, args); + } + +} \ No newline at end of file diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java new file mode 100644 index 0000000..e2a0c16 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java @@ -0,0 +1,116 @@ +package com.github.cato447.AbizeitungVotingSystem.controller; + +import com.github.cato447.AbizeitungVotingSystem.entities.Candidate; +import com.github.cato447.AbizeitungVotingSystem.entities.Voter; +import com.github.cato447.AbizeitungVotingSystem.repositories.CandidateRepository; +import com.github.cato447.AbizeitungVotingSystem.repositories.CategoryRepository; +import com.github.cato447.AbizeitungVotingSystem.repositories.VoterRepository; +import com.github.cato447.AbizeitungVotingSystem.table.TableAction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +@Controller +public class VotingController { + + private static final Logger LOGGER = LogManager.getLogger(VotingController.class); + + private TableAction tableAction = new TableAction(); + + List ipAddresses = new ArrayList(); + + @Autowired + VoterRepository voterRepository; + + @Autowired + CandidateRepository candidateRepository; + + @Autowired + CategoryRepository categoryRepository; + + @RequestMapping("/") + public String WelcomeSite() { + + if (voterRepository.findAll().size() == 0) { + tableAction.setUpVoters(voterRepository); + LOGGER.info("Voters successfully set up"); + } + if (candidateRepository.findAll().size() == 0) { + tableAction.setUpCandidates(candidateRepository); + LOGGER.info("Candidates successfully set up"); + } + + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) + .getRequest(); + + String currentIpAddress = request.getRemoteAddr(); + if (!this.ipAddresses.contains(currentIpAddress)) { + LOGGER.info("User IP: " + request.getRemoteAddr()); + ipAddresses.add(currentIpAddress); + } + + tableAction.logVoters(voterRepository); + tableAction.logCandidates(candidateRepository); + tableAction.logCategories(categoryRepository); + + return "start.html"; + } + + @RequestMapping("/vote") + public String VerifyName(@RequestParam String name, Model model) { + try { + Voter voter = voterRepository.findByEmail(name); + if (voter.getVote_status()) { + LOGGER.warn(name + " has already voted"); + return "errors/alreadyVoted.html"; + } else { + List candidates = candidateRepository.findAll(); + model.addAttribute("candidates", candidates); + LOGGER.info(name + " is voting now"); + return "voting.html"; + } + } catch (Exception e) { + LOGGER.error(name + " is not allowed to vote"); + return "errors/notRegistered.html"; + } + } + + @RequestMapping("/processVote") + public String ProcessVote(@RequestParam String name) { + LOGGER.info(name + " has voted"); + return "success.html"; + } + + @RequestMapping("/dashboard") + public String AccessDashboard(@RequestParam String name, @RequestParam String password, Model model){ + try { + if (name.equals("admin")) { + if (password.equals("admin")) { + List voters = voterRepository.findAll(); + List candidates = candidateRepository.findAll(); + model.addAttribute("voters", voters); + model.addAttribute("candidates", candidates); + return "dashboard.html"; + } else{ + LOGGER.error("Wrong Password"); + } + LOGGER.error("Wrong Username"); + } + } catch (Exception e){ + LOGGER.fatal("voters table is not existing!"); + } + return "redirect:/"; + } + +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Candidate.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Candidate.java new file mode 100644 index 0000000..3465da1 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Candidate.java @@ -0,0 +1,44 @@ +package com.github.cato447.AbizeitungVotingSystem.entities; + +import javax.persistence.*; + +@Entity +@Table(name = "candidates") +public class Candidate { + + public Candidate() { + super(); + } + + public Candidate(String name) { + super(); + this.name = name; + this.votes = 0; + } + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + private String name; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "category_id") + private Category category; + + private Integer votes; + + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public Integer getVotes() { + return votes; + } + + public String getCategory() {return category.getName();} +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Category.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Category.java new file mode 100644 index 0000000..d49d891 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Category.java @@ -0,0 +1,39 @@ +package com.github.cato447.AbizeitungVotingSystem.entities; + +import javax.persistence.*; +import java.util.List; + +@Entity +@Table(name="categories") +public class Category { + + public Category(){ + super(); + } + + public Category(String name, List candidateList) { + super(); + this.name = name; + this.candidateList = candidateList; + } + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + private long id; + private String name; + + @OneToMany(mappedBy = "category", fetch = FetchType.LAZY) + private List candidateList; + + public long getId() { + return id; + } + + public String getName() { + return name; + } + + public List getCandidateList() { + return candidateList; + } +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Voter.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Voter.java new file mode 100644 index 0000000..1e26ed4 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/entities/Voter.java @@ -0,0 +1,35 @@ +package com.github.cato447.AbizeitungVotingSystem.entities; + +import javax.persistence.*; + +@Entity +@Table(name="voters") +public class Voter { + + public Voter(){ + super(); + } + + public Voter(String email, boolean vote_status) { + this.email = email; + this.vote_status= vote_status; + } + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + private Long id; + private String email; + private Boolean vote_status; + + public Long getId() { + return id; + } + + public String getEmail() { + return email; + } + + public Boolean getVote_status() { + return vote_status; + } +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/CandidateRepository.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/CandidateRepository.java new file mode 100644 index 0000000..90e73a8 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/CandidateRepository.java @@ -0,0 +1,12 @@ +package com.github.cato447.AbizeitungVotingSystem.repositories; + +import com.github.cato447.AbizeitungVotingSystem.entities.Candidate; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CandidateRepository extends JpaRepository { + + public Candidate findByName(String name); + +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/CategoryRepository.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/CategoryRepository.java new file mode 100644 index 0000000..3529474 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/CategoryRepository.java @@ -0,0 +1,12 @@ +package com.github.cato447.AbizeitungVotingSystem.repositories; + +import com.github.cato447.AbizeitungVotingSystem.entities.Category; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface CategoryRepository extends JpaRepository { + + public Category findByName(String name); + +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/VoterRepository.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/VoterRepository.java new file mode 100644 index 0000000..035e8a7 --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/repositories/VoterRepository.java @@ -0,0 +1,14 @@ +package com.github.cato447.AbizeitungVotingSystem.repositories; + +import com.github.cato447.AbizeitungVotingSystem.entities.Voter; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface VoterRepository extends JpaRepository { + + public Voter findByEmail(String email); + + public Voter findById(Long id); + +} diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/table/TableAction.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/table/TableAction.java new file mode 100644 index 0000000..500f50d --- /dev/null +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/table/TableAction.java @@ -0,0 +1,119 @@ +package com.github.cato447.AbizeitungVotingSystem.table; + +import com.github.cato447.AbizeitungVotingSystem.entities.Candidate; +import com.github.cato447.AbizeitungVotingSystem.entities.Category; +import com.github.cato447.AbizeitungVotingSystem.entities.Voter; +import com.github.cato447.AbizeitungVotingSystem.repositories.CandidateRepository; +import com.github.cato447.AbizeitungVotingSystem.repositories.CategoryRepository; +import com.github.cato447.AbizeitungVotingSystem.repositories.VoterRepository; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.*; + +public class TableAction { + + public TableAction(){ + + } + + public void addCandidate(String name, CandidateRepository candidateRepository){ + Candidate candidate = new Candidate(name); + candidateRepository.save(candidate); + } + + public void setUpVoters(VoterRepository voterRepository){ + try { + File emailFile = new File("src/main/resources/Q2_emails.txt"); + Scanner myReader = new Scanner(emailFile); + ArrayList voters = new ArrayList(); + while (myReader.hasNextLine()) { + String email = myReader.nextLine(); + Voter voter = new Voter(email, false); + voters.add(voter); + } + voterRepository.saveAll(voters); + myReader.close(); + } catch (FileNotFoundException e) { + System.out.println("An error occurred."); + e.printStackTrace(); + } + } + + public void setUpCandidates(CandidateRepository candidateRepository){ + ArrayList names = new ArrayList<>(); + Collections.addAll(names, "Greta Bentgens", "Laura König", "Aaron Glos", "Lukas Boy", "Frau Meyering" + , "Frau Adams", "Herr Petering", "Frau Milde", "Frau Meyer"); + + ArrayList candidates = new ArrayList<>(); + for (String name: names) { + Candidate candidate = new Candidate(name); + candidates.add(candidate); + } + candidateRepository.saveAll(candidates); + } + + public String logCategories(CategoryRepository categoryRepository){ + List> rows = new ArrayList<>(); + List headers = Arrays.asList("Id", "Name", "Candidates"); + rows.add(headers); + + for (Category category: categoryRepository.findAll()) { + String candidateNames = ""; + for (Candidate candidate: category.getCandidateList()){ + candidateNames += candidate.getName() + "; "; + } + rows.add(Arrays.asList(""+category.getId(), category.getName(), candidateNames)); + } + return formatAsTable(rows); + } + + public String logVoters(VoterRepository voterRepository){ + List> rows = new ArrayList<>(); + List headers = Arrays.asList("Id", "E-Mail", "Vote_status"); + rows.add(headers); + for (Voter voter: voterRepository.findAll()) { + rows.add(Arrays.asList(""+voter.getId(), voter.getEmail(), ""+voter.getVote_status())); + } + + return formatAsTable(rows); + + } + + public String logCandidates(CandidateRepository candidateRepository){ + List> rows = new ArrayList<>(); + List headers = Arrays.asList("Id", "Name", "Votes"); + rows.add(headers); + for (Candidate candidate: candidateRepository.findAll()) { + rows.add(Arrays.asList(""+candidate.getId(), candidate.getName(), ""+candidate.getVotes())); + } + + return formatAsTable(rows); + } + + private String formatAsTable(List> rows) { + int[] maxLengths = new int[rows.get(0).size()]; + for (List row : rows) + { + for (int i = 0; i < row.size(); i++) + { + maxLengths[i] = Math.max(maxLengths[i], row.get(i).length()); + } + } + + StringBuilder formatBuilder = new StringBuilder(); + for (int maxLength : maxLengths) + { + formatBuilder.append("%-").append(maxLength + 2).append("s"); + } + String format = formatBuilder.toString(); + + StringBuilder result = new StringBuilder(); + result.append("\n"); + for (List row : rows) + { + result.append(String.format(format, row.toArray(new String[0]))).append("\n"); + } + return result.toString(); + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..21d71ef --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,5 @@ +spring.datasource.url=jdbc:mysql://localhost/VotingSystem +spring.datasource.username=root +spring.datasource.password=***REMOVED*** + +spring.jpa.hibernate.ddl-auto=update \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..2801b5a --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,41 @@ + + + + + + + + + %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable + + + + + + ${LOGS}/Voting.log + + %d %p [%t] %m%n + + + + + ${LOGS}/archived/%d{yyyy-MM-dd}.%i.log + + + 10MB + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/scripts/test.js b/src/main/resources/static/scripts/test.js new file mode 100644 index 0000000..accb025 --- /dev/null +++ b/src/main/resources/static/scripts/test.js @@ -0,0 +1,6 @@ +function Quadrat() { + var Eingabe = document.getElementsByName("name"); + var Ergebnis = Eingabe.value; + alert("Das Quadrat von " + Eingabe.value + " = " + Ergebnis); + Eingabe.value = "Aaron"; + } \ No newline at end of file diff --git a/src/main/resources/static/styles/dashboard.css b/src/main/resources/static/styles/dashboard.css new file mode 100644 index 0000000..5460eb8 --- /dev/null +++ b/src/main/resources/static/styles/dashboard.css @@ -0,0 +1,7 @@ +td.voted { + background-color: #f05048; +} + +td.notVoted { + background-color: #76ed6b; +} \ No newline at end of file diff --git a/src/main/resources/static/styles/start.css b/src/main/resources/static/styles/start.css new file mode 100644 index 0000000..8527639 --- /dev/null +++ b/src/main/resources/static/styles/start.css @@ -0,0 +1,18 @@ +body { + background-color: rgb(44, 49, 54); + font-family: Arial, Helvetica, sans-serif; +} + +h2 { + color: whitesmoke; + font-size: 2em; + font-family: Georgia, 'Times New Roman', Times, serif; + border-bottom: 5px dotted #e3e7ec; + border-top: 5px dotted white; + width: 50%; +} + +form { + color: #3cff00; + font-weight: bold; +} \ No newline at end of file diff --git a/src/main/resources/templates/dashboard.html b/src/main/resources/templates/dashboard.html new file mode 100644 index 0000000..d01db7b --- /dev/null +++ b/src/main/resources/templates/dashboard.html @@ -0,0 +1,58 @@ + + + + + + Title + + + + +

Wähler Liste

+ +
+ + + + + + + + + +
+
+ + + + + +
+
+ + + +
IdE-MailVote status
+
+ +

Kandidaten Liste

+
+ + + + + + + + + + + + + + +
IdNameVotesCategory
+
+ + + \ No newline at end of file diff --git a/src/main/resources/templates/errors/alreadyVoted.html b/src/main/resources/templates/errors/alreadyVoted.html new file mode 100644 index 0000000..635232a --- /dev/null +++ b/src/main/resources/templates/errors/alreadyVoted.html @@ -0,0 +1,11 @@ + + + + + Abizeitung 2020/2021 Voting + + +

Jeder darf nur einmal abstimmen!

+ Return to Login-Site + + \ No newline at end of file diff --git a/src/main/resources/templates/errors/notRegistered.html b/src/main/resources/templates/errors/notRegistered.html new file mode 100644 index 0000000..0c3143f --- /dev/null +++ b/src/main/resources/templates/errors/notRegistered.html @@ -0,0 +1,13 @@ + + + + + Abizeitung 2020/2021 Voting + + +

Ü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

+ Try again + + \ No newline at end of file diff --git a/src/main/resources/templates/start.html b/src/main/resources/templates/start.html new file mode 100644 index 0000000..4a4e765 --- /dev/null +++ b/src/main/resources/templates/start.html @@ -0,0 +1,25 @@ + + + + + + Abizeitung 2020/2021 Voting + + + + +

Gebe deine Adolfinum E-Mail Adresse ein

+
+ + +
+ +

Admin-Console Passwort

+
+ + + +
+ + + \ No newline at end of file diff --git a/src/main/resources/templates/test.html b/src/main/resources/templates/test.html new file mode 100644 index 0000000..77b50c0 --- /dev/null +++ b/src/main/resources/templates/test.html @@ -0,0 +1,66 @@ + + + + + + Abizeitung 2020/2021 Voting + + + + +

Paragraphes

+

This is a paragraph.

+

This is another paragraph.

+ +

Links

+ This is a link + +

HTML Images

+

HTML images are defined with the img tag:

+ Binary example picture + +

Line breaks

+

This is a
paragraph with a line break.

+ +

Styling

+

This is a red paragraph.

+ +

Title attribute

+

This is a paragraph.

+ +

Quotes in attributes

+

Example 1

+

Example 2

+ +

Bigger headings

+

Heading 1

+ +

HTML Display

+

+ This paragraph contains a lot of lines in the source code, but the browser ignores it. +

+

+ This paragraph contains a lot of spaces in the source code, but the browser ignores it. +

+ +

Poem Problem

+

+ 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. +

+ +
Solution:
+
+            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.
+    
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/voting.html b/src/main/resources/templates/voting.html new file mode 100644 index 0000000..023d5d6 --- /dev/null +++ b/src/main/resources/templates/voting.html @@ -0,0 +1,23 @@ + + + + + + Title + + + + +

Wähle deine Kandidaten:

+ +
+

+

+

+

+ +
+ + + \ No newline at end of file diff --git a/src/test/java/com/github/cato447/AbizeitungVotingSystem/AbizeitungVotingSystemApplicationTests.java b/src/test/java/com/github/cato447/AbizeitungVotingSystem/AbizeitungVotingSystemApplicationTests.java new file mode 100644 index 0000000..9062e96 --- /dev/null +++ b/src/test/java/com/github/cato447/AbizeitungVotingSystem/AbizeitungVotingSystemApplicationTests.java @@ -0,0 +1,13 @@ +package com.github.cato447.AbizeitungVotingSystem; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class AbizeitungVotingSystemApplicationTests { + + @Test + void contextLoads() { + } + +}