From: Roland Häder Date: Fri, 13 May 2016 15:03:30 +0000 (+0200) Subject: Some fixes (careful with cherry-picking): X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=22184b8ae0b3de0ba261a28a3c84a04b15ea9d6e;p=pizzaservice-war.git Some fixes (careful with cherry-picking): - resenEmailAddress is better, then the same validator can be used to look if the email address is registered - set correct JNDI name for resend-link EJB - ignored some strings for i18n - added message for above email address field - fixed condition check Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/resendlink/PIzzaResendLinkWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/resendlink/PIzzaResendLinkWebSessionBean.java index 3c7928fe..382a6afa 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/resendlink/PIzzaResendLinkWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/resendlink/PIzzaResendLinkWebSessionBean.java @@ -58,7 +58,7 @@ public class PIzzaResendLinkWebSessionBean extends BasePizzaController implement Context context = new InitialContext(); // Try to lookup - this.emailBean = (ResendLinkSessionBeanRemote) context.lookup(""); //NOI18N + this.emailBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/PizzaService-ejb/resendLink!org.mxchange.pizzaapplication.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N } catch (final NamingException e) { // Throw again throw new FaceletException(e); diff --git a/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java b/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java index 3d0c9c34..8e60cf77 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/emailaddress/PizzaEmailAddressValidator.java @@ -72,12 +72,13 @@ public class PizzaEmailAddressValidator extends BaseStringValidator implements V //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N // The required field - String[] requiredFields = {"emailAddress", "emailAddressRepeat"}; //NOI18N + String[] requiredFields = {"emailAddress", "emailAddressRepeat", "resendEmailAddress"}; //NOI18N // Pre-validation (example: not null, not a string, empty string ...) super.preValidate(context, component, value, requiredFields, false); // Get string from object ... ;-) + // @TODO Add IDN support (GNU lib?) Search for emailAddressRepeat String emailAddress = String.valueOf(value); // Checks if the email address matches a regex ("low-level" check, should also be done by ) @@ -92,11 +93,20 @@ public class PizzaEmailAddressValidator extends BaseStringValidator implements V 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 (this.contactBean.isEmailAddressRegistered(emailAddress)) { + 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)); } diff --git a/web/customer/empty_basket.xhtml b/web/customer/empty_basket.xhtml index 0865128c..a27aae9c 100644 --- a/web/customer/empty_basket.xhtml +++ b/web/customer/empty_basket.xhtml @@ -27,22 +27,26 @@ #{msg.RESEND_CONFIRMATION_LINK_LEGEND}
-
- +
+
-
- +
+
- -
- -
+
+ +
+ +
+ +
+