]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Some fixes (careful with cherry-picking):
authorRoland Häder <roland@mxchange.org>
Fri, 13 May 2016 15:03:30 +0000 (17:03 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 13 May 2016 20:38:56 +0000 (22:38 +0200)
- 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 <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java
src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java
web/guest/user/resend_link.xhtml

index 665dd59b3ed7c159df7b6a345acd1991aa305c40..3b30b982612f2dbc4e9764b776bb25ffa3944219 100644 (file)
@@ -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);
index bc5574dd454bd14d06fb356b69e3c74c975397e7..5f98e5fa7c4b161033728058b7804a29a815414a 100644 (file)
@@ -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 <f:validatorRegex />)
@@ -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));
                }
index 3b872258afae3ed56db9673220db09c09daf9234..6d5c617360854cf06310b9543f903524e45c0b76 100644 (file)
                                                        <legend title="#{msg.RESEND_CONFIRMATION_LINK_LEGEND_TITLE}">#{msg.RESEND_CONFIRMATION_LINK_LEGEND}</legend>
 
                                                        <div class="table_row">
-                                                               <div class="table_left25">
-                                                                       <h:outputLabel for="emailAddress" value="#{msg.GUEST_RESEND_LINK_ENTER_EMAIL_ADDRESS}" />
+                                                               <div class="table_left">
+                                                                       <h:outputLabel for="resendEmailAddress" value="#{msg.GUEST_RESEND_LINK_ENTER_EMAIL_ADDRESS}" />
                                                                </div>
 
-                                                               <div class="table_right75">
-                                                                       <h:inputText styleClass="input" id="emailAddress" size="20" maxlength="255" value="#{contactController.emailAddress}" required="true" requiredMessage="#{msg.EMAIL_ADDRESS_NOT_ENTERED}">
+                                                               <div class="table_right">
+                                                                       <h:inputText styleClass="input" id="resendEmailAddress" size="20" maxlength="255" value="#{resendController.emailAddress}" required="true" requiredMessage="#{msg.EMAIL_ADDRESS_NOT_ENTERED}">
                                                                                <f:validator validatorId="EmailAddressValidator" />
                                                                        </h:inputText>
                                                                </div>
                                                        </div>
-
-                                                       <div class="table_row">
-                                                               <h:outputText value="#{msg.GUEST_RESEND_CONFIRMATION_LINK_NOTICE}" />
-                                                       </div>
                                                </fieldset>
 
+                                               <div>
+                                                       <h:message for="resendEmailAddress" errorClass="errors" warnClass="warnings" fatalClass="errors" />
+                                               </div>
+
+                                               <div class="table_row">
+                                                       <h:outputText value="#{msg.GUEST_RESEND_CONFIRMATION_LINK_NOTICE}" />
+                                               </div>
+
                                                <div class="table_footer">
                                                        <h:commandButton styleClass="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
                                                        <h:commandButton styleClass="submit" type="submit" id="register" value="#{msg.BUTTON_RESEND_CONFIRMATION_LINK}" action="#{resendController.doResendLink()}" />