From 0ed0d305da7a3ba06babc1a9735a9ca1d5974173 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 12 Aug 2016 12:43:12 +0200 Subject: [PATCH] Continued a bit: (please cherry-pick) - please let the application and not the validator decide what to do with already registered or unregistered email addresses. - the validator should only validate (against regex) and not make sure (means control) that the valid email address is okay to use for the requested action. - else there is a double-check and the validator will come first with non-localized messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../JobsEmailAddressValidator.java | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java b/src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java index b2244a9e..fbf98ec6 100644 --- a/src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java +++ b/src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java @@ -92,27 +92,6 @@ public class JobsEmailAddressValidator extends BaseStringValidator implements Va // Not matching throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message)); } - - // Get client id (aka form id) - String clientId = component.getClientId(); - - // Is the email address already registered? - if ((!clientId.endsWith("resendEmailAddress")) && (this.contactBean.isEmailAddressRegistered(emailAddress))) { //NOI18N - // Generate message - String message = MessageFormat.format("Email address {0} is already registered.", emailAddress); //NOI18N - - // No, then abort here - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_INFO, message, message)); - } else if ((clientId.endsWith("resendEmailAddress")) && (!this.contactBean.isEmailAddressRegistered(emailAddress))) { //NOI18N - // Generate message - String message = MessageFormat.format("Email address {0} is not registered.", emailAddress); //NOI18N - - // No, then abort here - throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_INFO, message, message)); - } - - // Trace message - //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N } } -- 2.39.5