From f4fab04d1ed4ed1e32f9f96b1be3f4f08fc07739 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 12 Jul 2017 21:13:56 +0200 Subject: [PATCH] Please cherry-pick: - imported new location (package) of classes/interfaces - moved EJBs to proper locations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../user/FinancialsAdminUserSessionBean.java | 4 +--- .../model/user/FinancialsUserSessionBean.java | 2 +- .../FinancialsUserEmailChangeSessionBean.java | 4 ++-- .../login/FinancialsUserLoginSessionBean.java | 18 +++++++++--------- .../FinancialsUserRegistrationSessionBean.java | 8 ++++---- .../FinancialsResendLinkSessionBean.java | 11 ++++++----- 6 files changed, 23 insertions(+), 24 deletions(-) rename src/java/org/mxchange/{jusercore => juserlogincore}/model/user/login/FinancialsUserLoginSessionBean.java (89%) rename src/java/org/mxchange/{jusercore => juserlogincore}/model/user/register/FinancialsUserRegistrationSessionBean.java (96%) rename src/java/org/mxchange/{jusercore => juserlogincore}/model/user/resendlink/FinancialsResendLinkSessionBean.java (91%) diff --git a/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java index 90ec2d0..8bff252 100644 --- a/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java @@ -28,8 +28,8 @@ import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; -import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * An administrative user EJB @@ -259,7 +259,6 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsDatabaseBean i User updatedUser = this.userBean.updateUserData(user); // @TODO Create user lock history entry - // Send out email // @TODO externalize subject line this.sendEmail("User account locked", "user_account_locked", updatedUser, baseUrl, null); //NOI18N @@ -319,7 +318,6 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsDatabaseBean i User updatedUser = this.userBean.updateUserData(user); // @TODO Create user lock history entry - // Send out email // @TODO externalize subject line this.sendEmail("User account unlocked", "user_account_unlocked", updatedUser, baseUrl, null); //NOI18N diff --git a/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java index 0536ca6..7b7e88a 100644 --- a/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/FinancialsUserSessionBean.java @@ -41,8 +41,8 @@ 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.profilemodes.ProfileMode; -import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * A user EJB diff --git a/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java index f755391..8bad7f3 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java @@ -28,7 +28,7 @@ import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean; import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress; import org.mxchange.jusercore.model.email_address.EmailAddressChange; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; -import org.mxchange.jusercore.model.user.UserUtils; +import org.mxchange.juserlogincore.login.UserLoginUtils; /** * A session-scoped bean for changing email addresses @@ -206,7 +206,7 @@ public class FinancialsUserEmailChangeSessionBean extends BaseFinancialsDatabase // Search for free hash while (isUsed) { // Generate hash, there is already in UserUtils a nice method that can be used for this purpose. - hash = UserUtils.encryptPassword(String.format("%s:%s", emailAddress.getEmailAddress(), emailAddress.toString())); //NOI18N + hash = UserLoginUtils.encryptPassword(String.format("%s:%s", emailAddress.getEmailAddress(), emailAddress.toString())); //NOI18N // The hash *may* be unique, better test it Query query = this.getEntityManager().createNamedQuery("SearchEmailChangeByHash", EmailAddressChange.class); //NOI18N diff --git a/src/java/org/mxchange/jusercore/model/user/login/FinancialsUserLoginSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java similarity index 89% rename from src/java/org/mxchange/jusercore/model/user/login/FinancialsUserLoginSessionBean.java rename to src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java index 8f75e96..1492cc2 100644 --- a/src/java/org/mxchange/jusercore/model/user/login/FinancialsUserLoginSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/login/FinancialsUserLoginSessionBean.java @@ -14,23 +14,23 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jusercore.model.user.login; +package org.mxchange.juserlogincore.model.user.login; import java.text.MessageFormat; import javax.ejb.EJB; import javax.ejb.Stateless; import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean; -import org.mxchange.jusercore.container.login.LoginContainer; import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; -import org.mxchange.jusercore.model.login.user.UserLoginSessionBeanRemote; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; -import org.mxchange.jusercore.model.user.UserUtils; -import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.container.login.LoginContainer; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; +import org.mxchange.juserlogincore.login.UserLoginUtils; +import org.mxchange.juserlogincore.model.login.user.UserLoginSessionBeanRemote; +import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * A session EJB for user logins @@ -125,8 +125,8 @@ public class FinancialsUserLoginSessionBean extends BaseFinancialsDatabaseBean i * not match, the first one is the one from the calling bean/controller, the * second is the from database. *

- * @param container Container instance holding the user instance and - * clear-text password + * @param container Container instance holding the user instance and + * clear-text password * @param updatedUser Updated user instance found for given user name *

* @return Whether the password matches @@ -145,7 +145,7 @@ public class FinancialsUserLoginSessionBean extends BaseFinancialsDatabaseBean i } // Is it the same same password? - return UserUtils.ifPasswordMatches(container, updatedUser); + return UserLoginUtils.ifPasswordMatches(container, updatedUser); } } diff --git a/src/java/org/mxchange/jusercore/model/user/register/FinancialsUserRegistrationSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java similarity index 96% rename from src/java/org/mxchange/jusercore/model/user/register/FinancialsUserRegistrationSessionBean.java rename to src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java index efe97c8..8e2b9a1 100644 --- a/src/java/org/mxchange/jusercore/model/user/register/FinancialsUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jusercore.model.user.register; +package org.mxchange.juserlogincore.model.user.register; import java.text.MessageFormat; import java.util.Objects; @@ -30,7 +30,7 @@ import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; -import org.mxchange.jusercore.model.user.UserUtils; +import org.mxchange.juserlogincore.login.UserLoginUtils; /** * A session-scoped bean for user registration @@ -62,7 +62,7 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsDatabas */ public FinancialsUserRegistrationSessionBean () { // Call super constructor - super("jms/jfinancials-queue-factory", "jms/jfinancials-email-queue"); //NOI18N + super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N } @Override @@ -85,7 +85,7 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsDatabas // Find a free one while (confirmationKey == null) { // Create new one - String key = UserUtils.generatedConfirmationKey(user); + String key = UserLoginUtils.generatedConfirmationKey(user); // Set key as parameter query.setParameter("confirmKey", key); //NOI18N diff --git a/src/java/org/mxchange/jusercore/model/user/resendlink/FinancialsResendLinkSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java similarity index 91% rename from src/java/org/mxchange/jusercore/model/user/resendlink/FinancialsResendLinkSessionBean.java rename to src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java index 470237a..a66de30 100644 --- a/src/java/org/mxchange/jusercore/model/user/resendlink/FinancialsResendLinkSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package org.mxchange.jusercore.model.user.resendlink; +package org.mxchange.juserlogincore.model.user.resendlink; import java.text.MessageFormat; import java.util.Locale; @@ -24,10 +24,11 @@ import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; +import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; -import org.mxchange.jusercore.model.user.register.UserRegistrationSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * A session-based EJB for resending confirmation links @@ -59,7 +60,7 @@ public class FinancialsResendLinkSessionBean extends BaseFinancialsDatabaseBean */ public FinancialsResendLinkSessionBean () { // Call super constructor - super("jms/jfinancials-queue-factory", "jms/jfinancials-email-queue"); //NOI18N + super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N } @Override @@ -101,14 +102,14 @@ public class FinancialsResendLinkSessionBean extends BaseFinancialsDatabaseBean this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.resendConfirmationLink: confirmationKey={1}", this.getClass().getSimpleName(), confirmationKey)); //NOI18N // Get managed instance - User managedUser = this.getManagedUser(user); + User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId()); // Set it in user managedUser.setUserConfirmKey(confirmationKey); // Send email // @TODO: Internationlize the subject line somehow - this.sendEmail("Resend user confirmation link", "user_resend_confirmation_link", managedUser, baseUrl, null); //NOI18N + this.sendEmail("Resend user confirmation link", "user_resend_confirmation_link", managedUser, baseUrl, null); //NOI18N // Log trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.resendConfirmationLink: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N -- 2.39.5