From d1c8f24d3d859b301740ed24cb36e39355009468 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 18 Dec 2020 20:11:28 +0100 Subject: [PATCH] Fix error message --- .../AbizeitungVotingSystem/controller/VotingController.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java b/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java index 8e98735..369d649 100644 --- a/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java +++ b/src/main/java/com/github/cato447/AbizeitungVotingSystem/controller/VotingController.java @@ -111,13 +111,11 @@ public class VotingController { if (name.strip().toLowerCase().matches("[a-z]+\\.[a-z]+@adolfinum+\\.de$")) { try { LOGGER.warn(name); - try { - Voter voter = voterRepository.findByEmail(name.toLowerCase().strip()); - } catch (Exception e){ + Voter voter = voterRepository.findByEmail(name.toLowerCase().strip()); + if (voter == null){ LOGGER.error(name + " is not allowed to vote"); return "errors/notRegistered.html"; } - Voter voter = voterRepository.findByEmail(name.toLowerCase().strip()); if (voter.getVote_status() && votingPhase) { LOGGER.warn(name + " has already voted"); return "errors/alreadyVoted.html";