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=5bce3f86650aaa50a275825d08d6cc797cad8969;p=jfinancials-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/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java index 665dd59b..3b30b982 100644 --- a/src/java/org/mxchange/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java @@ -58,7 +58,7 @@ public class AddressbookResendLinkWebSessionBean extends BaseAddressbookControll 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/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java b/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java index bc5574dd..5f98e5fa 100644 --- a/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java +++ b/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java @@ -72,12 +72,13 @@ public class AddressbookEmailAddressValidator extends BaseStringValidator implem //* 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 AddressbookEmailAddressValidator extends BaseStringValidator implem 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/guest/user/resend_link.xhtml b/web/guest/user/resend_link.xhtml index 3b872258..6d5c6173 100644 --- a/web/guest/user/resend_link.xhtml +++ b/web/guest/user/resend_link.xhtml @@ -27,22 +27,26 @@ #{msg.RESEND_CONFIRMATION_LINK_LEGEND}
-
- +
+
-
- +
+
- -
- -
+
+ +
+ +
+ +
+