]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Injected contact controller as now stuff around contacts are done there, not in user.
authorRoland Haeder <roland@mxchange.org>
Wed, 20 Apr 2016 17:42:19 +0000 (19:42 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 20 Apr 2016 17:42:19 +0000 (19:42 +0200)
src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java

index 60f77b0ed605bdbb72d35eb66191d80983dc6a91..1eb3e905a133766e9dda8c6c4f59eafb822d54ac 100644 (file)
@@ -26,6 +26,7 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jratecalc.beans.contact.PizzaContactWebSessionController;
 import org.mxchange.jusercore.events.registration.RegisteredUserEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
@@ -51,6 +52,12 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess
         */
        private static final long serialVersionUID = 47_828_986_719_691_592L;
 
+       /**
+        * User controller
+        */
+       @Inject
+       private PizzaContactWebSessionController contactController;
+
        /**
         * Reemote register session bean
         */
@@ -100,12 +107,12 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess
                } else if (this.userController.isUserNameRegistered(user)) {
                        // User name is already used
                        throw new FaceletException(new UserNameAlreadyRegisteredException(user));
-               } else if (this.userController.isEmailAddressRegistered(user)) {
+               } else if (this.contactController.isEmailAddressRegistered(user.getUserContact())) {
                        // Email address has already been taken
                        throw new FaceletException(new EmailAddressAlreadyRegisteredException(user));
-               } else if (!this.userController.isSameEmailAddressEntered()) {
+               } else if (!this.contactController.isSameEmailAddressEntered()) {
                        // Not same email address entered
-                       throw new FaceletException(new DataRepeatMismatchException(MessageFormat.format("Email addresses not matching: {0} != {1}", this.userController.getEmailAddress(), this.userController.getEmailAddressRepeat()))); //NOI18N
+                       throw new FaceletException(new DataRepeatMismatchException(MessageFormat.format("Email addresses not matching: {0} != {1}", this.contactController.getEmailAddress(), this.contactController.getEmailAddressRepeat()))); //NOI18N
                } else if (!this.userController.isSamePasswordEntered()) {
                        // Not same password entered
                        throw new FaceletException(new DataRepeatMismatchException("Passwords not matching.")); //NOI18N