]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 22 Sep 2022 17:20:23 +0000 (19:20 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 22 Sep 2022 17:20:23 +0000 (19:20 +0200)
- registerBean is no longer used here (old, removed code)
- baseUrl should never be NULL or empty
- user.userContact must be valid

src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java

index 19b6eb36c18c6d955e133bea53ca3bb03910e8c4..f2fee3bbdaa589825acb7018b6a897aa185cb84e 100644 (file)
@@ -69,6 +69,12 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsEnterpriseBean
                } else if (user.getUserId() != null) {
                        // Not allowed here
                        throw new IllegalStateException(MessageFormat.format("user.userId must be null, is: {0}", user.getUserId())); //NOI18N
+               } else if (null == user.getUserContact()) {
+                       // Abort here
+                       throw new NullPointerException("user.contact is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() != null) {
+                       // Not allowed here
+                       throw new IllegalStateException(MessageFormat.format("user.userContact.contactId must be null, is: {0}", user.getUserId())); //NOI18N
                }
 
                // Check if user is registered
index 231ea0fc6f273bd7f18dd5359bdf863bada6687f..2e2d3e40cf12185f81f693e531dee3aeb08ee215 100644 (file)
@@ -20,7 +20,6 @@ import java.text.MessageFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
-import javax.ejb.EJB;
 import javax.ejb.EJBException;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
@@ -39,7 +38,6 @@ import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
 import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
 import org.mxchange.jusercore.model.user.password_history.UserPasswordHistory;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
 
 /**
  * A user EJB
@@ -54,12 +52,6 @@ public class FinancialsUserSessionBean extends BaseFinancialsEnterpriseBean impl
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * Registration EJB
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote")
-       private UserRegistrationSessionBeanRemote registerBean;
-
        /**
         * Default constructor
         */
@@ -92,6 +84,12 @@ public class FinancialsUserSessionBean extends BaseFinancialsEnterpriseBean impl
                } else if (user.getUserConfirmKey() == null) {
                        // Throw NPE
                        throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
+               } else if (null == baseUrl) {
+                       // Throw NPE again
+                       throw new NullPointerException("baseUrl is null"); //NOI18N
+               } else if (baseUrl.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
                }
 
                // Update user account
@@ -359,7 +357,7 @@ public class FinancialsUserSessionBean extends BaseFinancialsEnterpriseBean impl
                managedUser.setUserEntryUpdated(new Date());
 
                // Create history entry
-               PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser);
+               final PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser);
 
                // Set created timestamp
                entry.setUserPasswordHistoryCreated(new Date());