]> git.mxchange.org Git - jjobs-war.git/commitdiff
added/switched email change web controller. it will be later needed for the actual...
authorRoland Haeder <roland@mxchange.org>
Sat, 12 Mar 2016 16:22:54 +0000 (17:22 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 12 Mar 2016 16:22:54 +0000 (17:22 +0100)
src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/login/UserLoginWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/UserWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java
web/login/login_change_email_address.xhtml

diff --git a/src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionBean.java
new file mode 100644 (file)
index 0000000..4e01c8c
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2016 quix0r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.email_address;
+
+import java.text.MessageFormat;
+import java.util.Objects;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jjobs.beans.login.UserLoginWebSessionController;
+import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
+import org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A web session bean for changing email addresses
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("emailChangeController")
+@SessionScoped
+public class EmailChangeWebSessionBean implements EmailChangeWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 186_078_724_659_153L;
+
+       /**
+        * Email address 1 (changing)
+        */
+       private String emailAddress1;
+
+       /**
+        * Email address 2 (repeat in changing)
+        */
+       private String emailAddress2;
+
+       /**
+        * Remote email change bean
+        */
+       private final EmailChangeSessionBeanRemote emailBean;
+
+       /**
+        * Login bean (controller)
+        */
+       @Inject
+       private UserLoginWebSessionController loginController;
+
+       /**
+        * Default constructor
+        */
+       public EmailChangeWebSessionBean () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.emailBean = (EmailChangeSessionBeanRemote) context.lookup("ejb/stateless-jjobs-email-change"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public String doChangeEmailAddress () {
+               // This method shall only be called if the user is logged-in
+               if (!this.loginController.isUserLoggedIn()) {
+                       // Not logged-in
+                       throw new IllegalStateException("User is not logged-in"); //NOI18N
+               } else if (!this.isRequiredChangeEmailAddressSet()) {
+                       // Not all required fields are set
+                       throw new FaceletException("Not all required fields are set."); //NOI18N
+               } else if (!Objects.equals(this.getEmailAddress1(), this.getEmailAddress2())) {
+                       // Email address 1+2 mismatch
+                       throw new FaceletException("Email address 1/2 are mismatching."); //NOI18N
+               } else if (!this.loginController.ifCurrentPasswordMatches()) {
+                       // Password not matching
+                       throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
+               }
+
+               // Get user instance
+               User user = this.loginController.getLoggedInUser();
+
+               // It should be there, so run some tests on it
+               assert (user instanceof User) : "Instance loginController.loggedInUser is null";
+               assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
+               assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
+               assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
+               assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
+               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
+
+               // Update email address
+               user.getUserContact().setContactEmailAddress(this.getEmailAddress1());
+
+               // Call EJB
+               this.emailBean.enqueueEmailAddressForChange(user);
+
+               // All fine
+               return "login_email_change_queued"; //NOI18N
+       }
+
+       @Override
+       public String getEmailAddress1 () {
+               return this.emailAddress1;
+       }
+
+       @Override
+       public void setEmailAddress1 (final String emailAddress1) {
+               this.emailAddress1 = emailAddress1;
+       }
+
+       @Override
+       public String getEmailAddress2 () {
+               return this.emailAddress2;
+       }
+
+       @Override
+       public void setEmailAddress2 (final String emailAddress2) {
+               this.emailAddress2 = emailAddress2;
+       }
+
+       @Override
+       public boolean isRequiredChangeEmailAddressSet () {
+               return ((this.getEmailAddress1() != null) &&
+                               (this.getEmailAddress2() != null));
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionController.java b/src/java/org/mxchange/jjobs/beans/email_address/EmailChangeWebSessionController.java
new file mode 100644 (file)
index 0000000..3631e9d
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016 quix0r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.email_address;
+
+import java.io.Serializable;
+
+/**
+ * An interface for an email change controller
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface EmailChangeWebSessionController extends Serializable {
+
+       /**
+        * Getter for email address 1 (changing)
+        * <p>
+        * @return Email address
+        */
+       String getEmailAddress1 ();
+
+       /**
+        * Setter for email address 1 (changing)
+        * <p>
+        * @param emailAddress1 Email address 1
+        */
+       void setEmailAddress1 (final String emailAddress1);
+
+       /**
+        * Getter for email address 2 (repeat changing)
+        * <p>
+        * @return Email address 2
+        */
+       String getEmailAddress2 ();
+
+       /**
+        * Setter for email address 2 (repeat changing)
+        * <p>
+        * @param emailAddress2 Email address 2
+        */
+       void setEmailAddress2 (final String emailAddress2);
+
+       /**
+        * Checks whether all required are set for changing email address
+        * <p>
+        * @return Whether the required personal data is set
+        */
+       boolean isRequiredChangeEmailAddressSet ();
+
+       /**
+        * Changes logged-in user's email address if the current password matches.
+        * <p>
+        * @return New target page
+        */
+       String doChangeEmailAddress ();
+
+}
index 660e5c9a51f649682857bbb66e1235f0aa8b69dd..0b5cc8835e83ab1280e58671a2cc827af5801935 100644 (file)
@@ -139,24 +139,6 @@ public class UserLoginWebSessionBean implements UserLoginWebSessionController {
                }
        }
 
-       @Override
-       public boolean ifCurrentPasswordMatches () {
-               // The current password must be set and not empty
-               if (this.getCurrentPassword() == null) {
-                       // Is not set
-                       throw new NullPointerException("this.currentPassword is null"); //NOI18N
-               } else if (this.getCurrentPassword().isEmpty()) {
-                       // Is set empty
-                       throw new IllegalStateException("this.currentPassword is empty."); //NOI18N
-               }
-
-               // Create "container"
-               LoginContainer container = new UserLoginContainer(this.getLoggedInUser(), this.getCurrentPassword());
-
-               // Now check if it matches
-               return UserUtils.ifPasswordMatches(container, this.getLoggedInUser());
-       }
-
        @Override
        public String getCurrentPassword () {
                return currentPassword;
@@ -187,6 +169,24 @@ public class UserLoginWebSessionBean implements UserLoginWebSessionController {
                this.templateType = templateType;
        }
 
+       @Override
+       public boolean ifCurrentPasswordMatches () {
+               // The current password must be set and not empty
+               if (this.getCurrentPassword() == null) {
+                       // Is not set
+                       throw new NullPointerException("this.currentPassword is null"); //NOI18N
+               } else if (this.getCurrentPassword().isEmpty()) {
+                       // Is set empty
+                       throw new IllegalStateException("this.currentPassword is empty."); //NOI18N
+               }
+
+               // Create "container"
+               LoginContainer container = new UserLoginContainer(this.getLoggedInUser(), this.getCurrentPassword());
+
+               // Now check if it matches
+               return UserUtils.ifPasswordMatches(container, this.getLoggedInUser());
+       }
+
        @Override
        public boolean isGuest () {
                return (!this.isUserLoggedIn());
index 3656a577f127f3735e66a44b276b2fccdd9bd303..e116b66b8384f5a977084ebffb4573b6dd285e3a 100644 (file)
@@ -48,7 +48,6 @@ import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
-import org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
@@ -103,16 +102,6 @@ public class UserWebSessionBean implements UserWebSessionController {
         */
        private String emailAddress;
 
-       /**
-        * Email address 1 (changing)
-        */
-       private String emailAddress1;
-
-       /**
-        * Email address 2 (repeat in changing)
-        */
-       private String emailAddress2;
-
        /**
         * Email address list
         */
@@ -189,11 +178,6 @@ public class UserWebSessionBean implements UserWebSessionController {
         */
        private final UserSessionBeanRemote userBean;
 
-       /**
-        * Remote email change bean
-        */
-       private final EmailChangeSessionBeanRemote emailBean;
-
        /**
         * User id
         */
@@ -248,126 +232,12 @@ public class UserWebSessionBean implements UserWebSessionController {
 
                        // Try to lookup
                        this.userBean = (UserSessionBeanRemote) context.lookup("ejb/stateless-jjobs-user"); //NOI18N
-
-                       // Try to lookup
-                       this.emailBean = (EmailChangeSessionBeanRemote) context.lookup("ejb/stateless-jjobs-email-change"); //NOI18N
                } catch (final NamingException e) {
                        // Throw again
                        throw new FaceletException(e);
                }
        }
 
-       @Override
-       public String doChangePersonalData () {
-               // This method shall only be called if the user is logged-in
-               if (!this.loginController.isUserLoggedIn()) {
-                       // Not logged-in
-                       throw new IllegalStateException("User is not logged-in"); //NOI18N
-               } else if (!this.isRequiredChangePersonalDataSet()) {
-                       // Not all required fields are set
-                       throw new FaceletException("Not all required fields are set."); //NOI18N
-               } else if (!this.loginController.ifCurrentPasswordMatches()) {
-                       // Password not matching
-                       throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
-               }
-
-               // Get user instance
-               User user = this.loginController.getLoggedInUser();
-
-               // It should be there, so run some tests on it
-               assert (user instanceof User) : "Instance loginController.loggedInUser is null";
-               assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
-               assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
-               assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
-               assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
-               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
-
-               // Update all fields
-               user.setUserProfileMode(this.getUserProfileMode());
-               user.getUserContact().setContactGender(this.getGender());
-               user.getUserContact().setContactFirstName(this.getFirstName());
-               user.getUserContact().setContactFamilyName(this.getFamilyName());
-               user.getUserContact().setContactStreet(this.getStreet());
-               user.getUserContact().setContactHouseNumber(this.getHouseNumber());
-               user.getUserContact().setContactZipCode(this.getZipCode());
-               user.getUserContact().setContactCity(this.getCity());
-               user.getUserContact().setContactCountry(this.getCountry());
-
-               // Is there a phone number?
-               if (user.getUserContact().getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                       // Debug message
-                       System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: phoneId={0}", user.getUserContact().getContactLandLineNumber().getPhoneId())); //NOI18N
-
-                       // Yes, then update as well
-                       user.getUserContact().getContactLandLineNumber().setPhoneAreaCode(this.getPhoneAreaCode());
-                       user.getUserContact().getContactLandLineNumber().setPhoneNumber(this.getPhoneNumber());
-               }
-
-               // Is there a fax number?
-               if (user.getUserContact().getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Debug message
-                       System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: faxId={0}", user.getUserContact().getContactFaxNumber().getPhoneId())); //NOI18N
-
-                       // Yes, then update as well
-                       user.getUserContact().getContactFaxNumber().setPhoneAreaCode(this.getFaxAreaCode());
-                       user.getUserContact().getContactFaxNumber().setPhoneNumber(this.getFaxNumber());
-               }
-
-               // Is there a cellphone number?
-               if (user.getUserContact().getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
-                       // Debug message
-                       System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: cellPhoneId={0}", user.getUserContact().getContactCellphoneNumber().getPhoneId())); //NOI18N
-
-                       // Yes, then update as well
-                       user.getUserContact().getContactCellphoneNumber().setCellphoneProvider(this.getCellphoneCarrier());
-                       user.getUserContact().getContactCellphoneNumber().setPhoneNumber(this.getCellphoneNumber());
-               }
-
-               // Send it to the EJB
-               this.userBean.updateUserPersonalData(user);
-
-               // All fine
-               return "login_data_saved"; //NOI18N
-       }
-
-       @Override
-       public String doChangeEmailAddress () {
-               // This method shall only be called if the user is logged-in
-               if (!this.loginController.isUserLoggedIn()) {
-                       // Not logged-in
-                       throw new IllegalStateException("User is not logged-in"); //NOI18N
-               } else if (!this.isRequiredChangeEmailAddressSet()) {
-                       // Not all required fields are set
-                       throw new FaceletException("Not all required fields are set."); //NOI18N
-               } else if (!Objects.equals(this.getEmailAddress1(), this.getEmailAddress2())) {
-                       // Email address 1+2 mismatch
-                       throw new FaceletException("Email address 1/2 are mismatching."); //NOI18N
-               } else if (!this.loginController.ifCurrentPasswordMatches()) {
-                       // Password not matching
-                       throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
-               }
-
-               // Get user instance
-               User user = this.loginController.getLoggedInUser();
-
-               // It should be there, so run some tests on it
-               assert (user instanceof User) : "Instance loginController.loggedInUser is null";
-               assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
-               assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
-               assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
-               assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
-               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
-
-               // Update email address
-               user.getUserContact().setContactEmailAddress(this.getEmailAddress1());
-
-               // Call EJB
-               this.emailBean.enqueueEmailAddressForChange(user);
-
-               // All fine
-               return "login_data_saved"; //NOI18N
-       }
-
        @Override
        public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) {
                // Trace message
@@ -555,6 +425,79 @@ public class UserWebSessionBean implements UserWebSessionController {
                return user;
        }
 
+       @Override
+       public String doChangePersonalData () {
+               // This method shall only be called if the user is logged-in
+               if (!this.loginController.isUserLoggedIn()) {
+                       // Not logged-in
+                       throw new IllegalStateException("User is not logged-in"); //NOI18N
+               } else if (!this.isRequiredChangePersonalDataSet()) {
+                       // Not all required fields are set
+                       throw new FaceletException("Not all required fields are set."); //NOI18N
+               } else if (!this.loginController.ifCurrentPasswordMatches()) {
+                       // Password not matching
+                       throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
+               }
+
+               // Get user instance
+               User user = this.loginController.getLoggedInUser();
+
+               // It should be there, so run some tests on it
+               assert (user instanceof User) : "Instance loginController.loggedInUser is null";
+               assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
+               assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
+               assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
+               assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
+               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
+
+               // Update all fields
+               user.setUserProfileMode(this.getUserProfileMode());
+               user.getUserContact().setContactGender(this.getGender());
+               user.getUserContact().setContactFirstName(this.getFirstName());
+               user.getUserContact().setContactFamilyName(this.getFamilyName());
+               user.getUserContact().setContactStreet(this.getStreet());
+               user.getUserContact().setContactHouseNumber(this.getHouseNumber());
+               user.getUserContact().setContactZipCode(this.getZipCode());
+               user.getUserContact().setContactCity(this.getCity());
+               user.getUserContact().setContactCountry(this.getCountry());
+
+               // Is there a phone number?
+               if (user.getUserContact().getContactLandLineNumber() instanceof DialableLandLineNumber) {
+                       // Debug message
+                       System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: phoneId={0}", user.getUserContact().getContactLandLineNumber().getPhoneId())); //NOI18N
+
+                       // Yes, then update as well
+                       user.getUserContact().getContactLandLineNumber().setPhoneAreaCode(this.getPhoneAreaCode());
+                       user.getUserContact().getContactLandLineNumber().setPhoneNumber(this.getPhoneNumber());
+               }
+
+               // Is there a fax number?
+               if (user.getUserContact().getContactFaxNumber() instanceof DialableFaxNumber) {
+                       // Debug message
+                       System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: faxId={0}", user.getUserContact().getContactFaxNumber().getPhoneId())); //NOI18N
+
+                       // Yes, then update as well
+                       user.getUserContact().getContactFaxNumber().setPhoneAreaCode(this.getFaxAreaCode());
+                       user.getUserContact().getContactFaxNumber().setPhoneNumber(this.getFaxNumber());
+               }
+
+               // Is there a cellphone number?
+               if (user.getUserContact().getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
+                       // Debug message
+                       System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: cellPhoneId={0}", user.getUserContact().getContactCellphoneNumber().getPhoneId())); //NOI18N
+
+                       // Yes, then update as well
+                       user.getUserContact().getContactCellphoneNumber().setCellphoneProvider(this.getCellphoneCarrier());
+                       user.getUserContact().getContactCellphoneNumber().setPhoneNumber(this.getCellphoneNumber());
+               }
+
+               // Send it to the EJB
+               this.userBean.updateUserPersonalData(user);
+
+               // All fine
+               return "login_data_saved"; //NOI18N
+       }
+
        @Override
        public Date getBirthday () {
                return this.birthday;
@@ -625,26 +568,6 @@ public class UserWebSessionBean implements UserWebSessionController {
                this.emailAddress = emailAddress;
        }
 
-       @Override
-       public String getEmailAddress1 () {
-               return this.emailAddress1;
-       }
-
-       @Override
-       public void setEmailAddress1 (final String emailAddress1) {
-               this.emailAddress1 = emailAddress1;
-       }
-
-       @Override
-       public String getEmailAddress2 () {
-               return this.emailAddress2;
-       }
-
-       @Override
-       public void setEmailAddress2 (final String emailAddress2) {
-               this.emailAddress2 = emailAddress2;
-       }
-
        @Override
        public String getEmailAddressRepeat () {
                return this.emailAddressRepeat;
@@ -852,38 +775,32 @@ public class UserWebSessionBean implements UserWebSessionController {
        }
 
        @Override
-       public boolean isRequiredPersonalDataSet () {
-               return ((this.getUserName() != null) &&
-                               (this.getUserProfileMode() != null) &&
+       public boolean isRequiredChangePersonalDataSet () {
+               return ((this.getUserProfileMode() != null) &&
                                (this.getGender() != null) &&
                                (this.getFirstName() != null) &&
                                (this.getFamilyName() != null) &&
                                (this.getStreet() != null) &&
                                (this.getHouseNumber() != null) &&
                                (this.getZipCode() != null) &&
-                               (this.getCity() != null) &&
-                               (this.getEmailAddress() != null) &&
-                               (this.getEmailAddressRepeat() != null) &&
-                               (this.getUserPassword() != null) &&
-                               (this.getUserPasswordRepeat() != null));
+                               (this.getCity() != null));
        }
 
        @Override
-       public boolean isRequiredChangePersonalDataSet () {
-               return ((this.getUserProfileMode() != null) &&
+       public boolean isRequiredPersonalDataSet () {
+               return ((this.getUserName() != null) &&
+                               (this.getUserProfileMode() != null) &&
                                (this.getGender() != null) &&
                                (this.getFirstName() != null) &&
                                (this.getFamilyName() != null) &&
                                (this.getStreet() != null) &&
                                (this.getHouseNumber() != null) &&
                                (this.getZipCode() != null) &&
-                               (this.getCity() != null));
-       }
-
-       @Override
-       public boolean isRequiredChangeEmailAddressSet () {
-               return ((this.getEmailAddress1() != null) &&
-                               (this.getEmailAddress2() != null));
+                               (this.getCity() != null) &&
+                               (this.getEmailAddress() != null) &&
+                               (this.getEmailAddressRepeat() != null) &&
+                               (this.getUserPassword() != null) &&
+                               (this.getUserPasswordRepeat() != null));
        }
 
        @Override
index 1794c3dc1878567f73bcbab0bfa2c628ac55160e..44097b9e6f013611e87a25044b532f0a7ade78e1 100644 (file)
@@ -25,7 +25,6 @@ import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 
@@ -174,34 +173,6 @@ public interface UserWebSessionController extends Serializable {
         */
        void setEmailAddress (final String emailAddress);
 
-       /**
-        * Getter for email address 1 (changing)
-        * <p>
-        * @return Email address
-        */
-       String getEmailAddress1 ();
-
-       /**
-        * Setter for email address 1 (changing)
-        * <p>
-        * @param emailAddress1 Email address 1
-        */
-       void setEmailAddress1 (final String emailAddress1);
-
-       /**
-        * Getter for email address 2 (repeat changing)
-        * <p>
-        * @return Email address 2
-        */
-       String getEmailAddress2 ();
-
-       /**
-        * Setter for email address 2 (repeat changing)
-        * <p>
-        * @param emailAddress2 Email address 2
-        */
-       void setEmailAddress2 (final String emailAddress2);
-
        /**
         * Getter for email address, repeated
         * <p>
@@ -477,13 +448,6 @@ public interface UserWebSessionController extends Serializable {
         */
        boolean isRequiredChangePersonalDataSet ();
 
-       /**
-        * Checks whether all required are set for changing email address
-        * <p>
-        * @return Whether the required personal data is set
-        */
-       boolean isRequiredChangeEmailAddressSet ();
-
        /**
         * Checks whether same email addresses have been entered
         * <p>
@@ -527,15 +491,6 @@ public interface UserWebSessionController extends Serializable {
         * and TAC + privacy statement has been accepted.
         * <p>
         * @return New target page
-        * <p>
-        * @throws UserPasswordMismatchException If the entered password doesn't match
         */
        String doChangePersonalData ();
-
-       /**
-        * Changes logged-in user's email address if the current password matches.
-        * <p>
-        * @return New target page
-        */
-       String doChangeEmailAddress ();
 }
index 33afeae1d45aa3e5e7de67fbb9bddbb6cbceb3dc..adc9608f0fd3e5238da2c792d3e6ff6b178c164b 100644 (file)
@@ -43,7 +43,7 @@
                                                                        </div>
 
                                                                        <div class="table_right">
-                                                                               <h:inputText class="input" id="emailAddress1" size="20" maxlength="255" value="#{userController.emailAddress1}" required="true" />
+                                                                               <h:inputText class="input" id="emailAddress1" size="20" maxlength="255" value="#{emailChangeController.emailAddress1}" required="true" />
                                                                        </div>
 
                                                                        <div class="clear"></div>
@@ -55,7 +55,7 @@
                                                                        </div>
 
                                                                        <div class="table_right">
-                                                                               <h:inputText class="input" id="emailAddress2" size="20" maxlength="255" value="#{userController.emailAddress2}" required="true" />
+                                                                               <h:inputText class="input" id="emailAddress2" size="20" maxlength="255" value="#{emailChangeController.emailAddress2}" required="true" />
                                                                        </div>
 
                                                                        <div class="clear"></div>
@@ -67,7 +67,7 @@
 
                                                <div class="table_footer">
                                                        <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                                       <h:commandButton class="submit" type="submit" id="change_email" value="#{msg.BUTTON_CHANGE_EMAIL_ADDRESS}" action="#{userController.doChangeEmailAddress()}" />
+                                                       <h:commandButton class="submit" type="submit" id="change_email" value="#{msg.BUTTON_CHANGE_EMAIL_ADDRESS}" action="#{emailChangeController.doChangeEmailAddress()}" />
                                                </div>
                                        </h:form>
                                </div>