]> git.mxchange.org Git - jjobs-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>
Sat, 14 May 2016 13:14:34 +0000 (15:14 +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/jjobs/beans/resendlink/JobsResendLinkWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java
src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java
web/guest/user/resend_link.xhtml

index 56a04143057e7b01062b163f29988a01543741bf..33a5f591f67c564804f0d61a902f3f5b436a366b 100644 (file)
@@ -58,7 +58,7 @@ public class JobsResendLinkWebSessionBean extends BaseJobsController implements
                        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 92d7d3482f87d41a9a38a1a2327cf2b7ce333e4c..623e3fa3bfee5d8a61fe58b7560ccde70a356c27 100644 (file)
@@ -115,14 +115,6 @@ public interface JobsUserWebSessionController extends Serializable {
         */
        boolean isContactFound (final Contact contact);
 
-       /**
-        * Observes events being fired when an administrator has added a new
-        * contact.
-        * <p>
-        * @param event Event being fired
-        */
-       void afterAdminAddedContact (final AdminAddedContactEvent event);
-
        /**
         * Checks whether a public user account is registered. This means that at
         * least one user profile has its flag "public user profile" enabled.
index 3cfd3158aa7b6c4013d4cf1032deba2139b19cb7..b3889b59ef12cce4f828ff79764583550662bd8d 100644 (file)
@@ -72,12 +72,13 @@ public class JobsEmailAddressValidator extends BaseStringValidator implements Va
                //* 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 JobsEmailAddressValidator extends BaseStringValidator implements Va
                        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()}" />