From: Roland Häder Date: Wed, 12 Jul 2017 19:30:17 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=062602dedfda677701babe53815aadbc433a024e;p=jjobs-war.git Please cherry-pick: - imported from new package Signed-off-by: Roland Häder --- diff --git a/lib/juser-login-core.jar b/lib/juser-login-core.jar new file mode 100644 index 00000000..be519226 Binary files /dev/null and b/lib/juser-login-core.jar differ diff --git a/lib/juser-login-lib.jar b/lib/juser-login-lib.jar new file mode 100644 index 00000000..d3b43b45 Binary files /dev/null and b/lib/juser-login-lib.jar differ diff --git a/nbproject/project.properties b/nbproject/project.properties index c6dde2ed..9c48c459 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -53,6 +53,8 @@ file.reference.juser-activity-core.jar=lib/juser-activity-core.jar file.reference.juser-activity-lib.jar=lib/juser-activity-lib.jar file.reference.juser-core.jar=lib/juser-core.jar file.reference.juser-lib.jar=lib/juser-lib.jar +file.reference.juser-login-core.jar=lib/juser-login-core.jar +file.reference.juser-login-lib.jar=lib/juser-login-lib.jar includes=** j2ee.compile.on.save=true j2ee.copy.static.files.on.save=true @@ -78,9 +80,11 @@ javac.classpath=\ ${file.reference.juser-core.jar}:\ ${file.reference.juser-lib.jar}:\ ${file.reference.juser-activity-core.jar}:\ + ${file.reference.juser-login-core.jar}:\ + ${file.reference.juser-login-lib.jar}:\ + ${file.reference.juser-activity-lib.jar}:\ ${file.reference.jcontacts-business-core.jar}:\ ${file.reference.jcontacts-business-lib.jar}:\ - ${file.reference.juser-activity-lib.jar}:\ ${file.reference.jaddressbook-core.jar}:\ ${file.reference.jaddressbook-lib.jar}:\ ${reference.jjobs-core.jar}:\ @@ -149,6 +153,8 @@ source.reference.juser-core.jar=../juser-core/src/ source.reference.juser-lib.jar=../juser-lib/src/ source.reference.jaddressbook-core.jar=../jaddressbook-core/src/ source.reference.jaddressbook-lib.jar=../jaddressbook-lib/src/ +source.reference.juser-login-core.jar=../juser-login-core/src/ +source.reference.juser-login-lib.jar=../juser-login-lib/src/ source.root=src src.dir=${source.root}/java test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index 2d24ce94..86216d80 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -40,14 +40,20 @@ ${file.reference.juser-activity-core.jar} - ${file.reference.jcontacts-business-core.jar} + ${file.reference.juser-login-core.jar} - ${file.reference.jcontacts-business-lib.jar} + ${file.reference.juser-login-lib.jar} ${file.reference.juser-activity-lib.jar} + + ${file.reference.jcontacts-business-core.jar} + + + ${file.reference.jcontacts-business-lib.jar} + ${file.reference.jaddressbook-core.jar} diff --git a/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java index d5f45d7c..a883a7f0 100644 --- a/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java @@ -43,8 +43,8 @@ import org.mxchange.jaddressbook.model.addressbook.UserAddressbook; import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; import org.mxchange.jusercore.model.user.User; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; /** * An address book bean (controller) diff --git a/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java b/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java index bc3fa3d0..ee30ec31 100644 --- a/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java @@ -22,8 +22,8 @@ import java.util.List; import org.mxchange.jaddressbook.events.addressbook.ObservableAddressbookLoadedEvent; import org.mxchange.jaddressbook.model.addressbook.Addressbook; import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; import org.mxchange.jusercore.model.user.User; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; /** * An interface for address book beans diff --git a/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java index fddd64e2..c36b830c 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java @@ -22,15 +22,10 @@ import java.util.Date; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Locale; -import java.util.MissingResourceException; import java.util.Objects; -import java.util.ResourceBundle; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Observes; -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; @@ -39,16 +34,16 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; +import org.mxchange.jcontacts.contact.ContactUtils; import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcontacts.contact.title.PersonalTitle; -import org.mxchange.jcontacts.contact.ContactUtils; import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent; import org.mxchange.jcontacts.exceptions.ContactNotFoundException; import org.mxchange.jcountry.data.Country; import org.mxchange.jjobs.beans.BaseJobsController; -import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; +import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; @@ -56,13 +51,13 @@ import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.mobile.MobileNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; -import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; import org.mxchange.jusercore.model.user.User; +import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; +import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; /** * A general contact controller (bean) @@ -71,7 +66,7 @@ import org.mxchange.jusercore.model.user.User; */ @Named ("contactController") @SessionScoped -public abstract class JobsContactWebSessionBean extends BaseJobsController implements JobsContactWebSessionController { +public class JobsContactWebSessionBean extends BaseJobsController implements JobsContactWebSessionController { /** * Serial number @@ -1173,131 +1168,4 @@ public abstract class JobsContactWebSessionBean extends BaseJobsController imple this.contactList.add(contact); } - /** - * Returns given property key or throws an exception if not found. - *

- * @param parameterKey Property key - *

- * @return Property value - *

- * @throws NullPointerException If given key is not found - * @throws NumberFormatException If no number is given in context parameter - */ - protected int getIntegerContextParameter (final String parameterKey) throws NullPointerException, NumberFormatException { - // Get context parameter - Integer contextValue = Integer.parseInt(this.getStringContextParameter(parameterKey)); - // Return it - return contextValue; - } - - /** - * Returns given property key or throws an exception if not found. - *

- * @param parameterKey Property key - *

- * @return Property value - *

- * @throws NullPointerException If given key is not found - */ - protected String getStringContextParameter (final String parameterKey) throws NullPointerException { - // Get context parameter - String contextValue = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(parameterKey); - // Is it null? - if (null == contextValue) { - // Throw NPE - throw new NullPointerException(MessageFormat.format("parameterKey={0} is not set.", parameterKey)); //NOI18N - } - // Return it - return contextValue; - } - - /** - * Checks whether debug mode is enabled for given controller - *

- * @param controllerName Name of controller - *

- * @return Whether debug mode is enabled - */ - protected boolean isDebugModeEnabled (final String controllerName) { - // Parameters should be valid - if (null == controllerName) { - // Throw NPE - throw new NullPointerException("controllerName is null"); //NOI18N - } else if (controllerName.isEmpty()) { - // Is empty - throw new IllegalArgumentException("controllerName is empty"); //NOI18N - } - // Try to get context parameter - String contextParameter = this.getStringContextParameter(String.format("is_debug_%s_enabled", controllerName)); //NOI18N - // Is it set and true? - boolean isEnabled = Boolean.parseBoolean(contextParameter) == Boolean.TRUE; - // Return it - return isEnabled; - } - - /** - * Loads resource bundle for given locale. This must be implemented per - * project so all projects can still customize their methods. Calling - * ResourceBundleloadBundle() in this class means that also the bundle files - * must be present here. - *

- * @param locale Locale from e.g. FacesContext - *

- * @return Initialized and loaded resource bundle - */ - protected abstract ResourceBundle loadResourceBundle (final Locale locale); - - /** - * Shows a faces message for given causing exception. The message from the - * exception is being inserted into the message. - *

- * @param clientId Client id to send message to - * @param cause Causing exception - */ - protected void showFacesMessage (final String clientId, final Throwable cause) { - // Get context and add message - this.showFacesMessage(clientId, cause.getMessage()); - } - - /** - * Shows a faces message with given message (i18n) key. - *

- * @param clientId Client id to send message to - * @param i18nKey Message key - *

- * @throws NullPointerException If clientId or i18nKey is null - * @throws IllegalArgumentException If clientId or i18nKey is empty - */ - protected void showFacesMessage (final String clientId, final String i18nKey) throws NullPointerException, IllegalArgumentException { - // Both parameter must be valid - if (null == clientId) { - // Throw NPE - throw new NullPointerException("clientId is null"); //NOI18N - } else if (clientId.isEmpty()) { - // Is empty - throw new IllegalArgumentException("clientId is null"); //NOI18N - } else if (null == i18nKey) { - // Throw NPE - throw new NullPointerException("i18nKey is null"); //NOI18N - } else if (i18nKey.isEmpty()) { - // Is empty - throw new IllegalArgumentException("i18nKey is null"); //NOI18N - } - // Get current locale - Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale(); - // Get bundle bundle - ResourceBundle bundle = this.loadResourceBundle(locale); - // Default is i18nKey - String message = MessageFormat.format("!{0}!", i18nKey); //NOI18N - // Try it - try { - // Get message - message = bundle.getString(i18nKey); - } catch (final MissingResourceException ex) { - // Did not find it, ignored - } - // Get context and add message - FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(message)); - } - } diff --git a/src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java b/src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java index 8b699463..21b49eb9 100644 --- a/src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java @@ -24,8 +24,8 @@ import javax.enterprise.event.Observes; import javax.faces.context.FacesContext; import javax.inject.Named; import org.mxchange.jjobs.beans.BaseJobsController; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; +import org.mxchange.juserlogincore.events.logout.ObservableUserLogoutEvent; /** * A session-scoped bean for handling localization/internationalization changes. diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java index b13849c1..8ee995be 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java @@ -37,8 +37,6 @@ import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController; import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController; import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController; import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController; -import org.mxchange.jusercore.container.login.UserLoginContainer; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.delete.AdminDeletedUserEvent; @@ -54,7 +52,6 @@ import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataE import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserPasswordRepeatMismatchException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; @@ -62,9 +59,12 @@ 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.jusercore.model.user.profilemodes.ProfileMode; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.container.login.UserLoginContainer; +import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.juserlogincore.exceptions.UserPasswordRepeatMismatchException; +import org.mxchange.juserlogincore.login.UserLoginUtils; /** * A user controller (bean) @@ -285,7 +285,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J return ""; //NOI18N } else if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) { // Empty password entered, then generate one - password = UserUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + password = UserLoginUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); } else if (!this.isSamePasswordEntered()) { // Both passwords don't match throw new FaceletException(new UserPasswordRepeatMismatchException(user)); @@ -299,7 +299,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J assert (password.length() >= JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N // Encrypt password and set it - user.setUserEncryptedPassword(UserUtils.encryptPassword(password)); + user.setUserEncryptedPassword(UserLoginUtils.encryptPassword(password)); try { // Now, that all is set, call EJB @@ -430,7 +430,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J return ""; //NOI18N } else if (this.isSamePasswordEntered()) { // Same password entered, create container - if ((Objects.equals(user.getUserMustChangePassword(), this.getUserMustChangePassword())) && (UserUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword())))) { + if ((Objects.equals(user.getUserMustChangePassword(), this.getUserMustChangePassword())) && (UserLoginUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword())))) { // Clear password fields this.setUserPassword(null); this.setUserPasswordRepeat(null); @@ -441,7 +441,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J } // Encrypt password - encryptedPassword = UserUtils.encryptPassword(this.getUserPassword()); + encryptedPassword = UserLoginUtils.encryptPassword(this.getUserPassword()); } // Set user name and flag diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java index 3aab2978..751a7420 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java @@ -38,26 +38,26 @@ import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController; import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController; import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController; import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent; import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent; import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent; import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; 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.jusercore.model.user.profilemodes.ProfileMode; +import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; +import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; +import org.mxchange.juserlogincore.login.UserLoginUtils; /** * A user controller (bean) @@ -519,7 +519,7 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs this.setUserProfileMode(ProfileMode.INVISIBLE); // Generate random password - String randomPassword = UserUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + String randomPassword = UserLoginUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); // Set random password this.setUserPassword(randomPassword); diff --git a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java index 5317d968..0adf5d0c 100644 --- a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java @@ -22,15 +22,10 @@ import java.util.GregorianCalendar; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; -import java.util.Locale; import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; @@ -38,25 +33,25 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jjobs.beans.BaseJobsController; -import org.mxchange.jusercore.model.user.User; -import org.mxchange.jusercore.model.user.activity.LogableUserActivity; -import org.mxchange.jusercore.model.user.activity.UserActivityLog; -import org.mxchange.jusercore.model.user.activity.UserActivityLogSessionBeanRemote; -import org.mxchange.jusercore.model.user.activity.comparator.UserActivityLogTimestampComparator; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; -import org.mxchange.jusercore.events.resendlink.ObservableUserResendLinkAccountEvent; +import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; -import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent; import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent; import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; -import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.activity.LogableUserActivity; +import org.mxchange.jusercore.model.user.activity.UserActivityLog; +import org.mxchange.jusercore.model.user.activity.UserActivityLogSessionBeanRemote; +import org.mxchange.jusercore.model.user.activity.comparator.UserActivityLogTimestampComparator; +import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; +import org.mxchange.juserlogincore.events.logout.ObservableUserLogoutEvent; +import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.juserlogincore.events.resendlink.ObservableUserResendLinkAccountEvent; +import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; /** * A controller (bean) for user activity log @@ -65,7 +60,7 @@ import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController; */ @Named ("userActivityController") @ApplicationScoped -public abstract class JobsUserActivityWebApplicationBean extends BaseJobsController implements JobsUserActivityWebApplicationController { +public class JobsUserActivityWebApplicationBean extends BaseJobsController implements JobsUserActivityWebApplicationController { /** * Serial number @@ -175,7 +170,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivityToCache(userActivity); } - @Override + /** + * Event observer for newly added users by administrator + *

+ * @param event Event being fired + */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { // event should not be null if (null == event) { @@ -196,7 +195,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getAddedUser(), "ADMIN_ADDED_USER_ACCOUNT"); //NOI18N } - @Override + /** + * Event observer for deleted user accounts (by administrator) + *

+ * @param event Event being fired + */ public void afterAdminDeletedUserEvent (@Observes final ObservableAdminDeletedUserEvent event) { // event should not be null if (null == event) { @@ -217,7 +220,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getDeletedUser(), "ADMIN_DELETED_USER_ACCOUNT", event.getUserDeleteReason()); //NOI18N } - @Override + /** + * Event observer for linked users with existing contact data + *

+ * @param event Event being fired + */ public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) { // event should not be null if (null == event) { @@ -238,7 +245,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getLinkedUser(), "ADMIN_LINKED_USER_ACCOUNT"); //NOI18N } - @Override + /** + * Event observer for locked users + *

+ * @param event Event being fired + */ public void afterAdminLockedUserEvent (@Observes final ObservableAdminLockedUserEvent event) { // event should not be null if (null == event) { @@ -259,7 +270,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getLockedUser(), "ADMIN_LOCKED_USER_ACCOUNT", event.getLockedUser().getUserLastLockedReason()); //NOI18N } - @Override + /** + * Event observer for unlocked users + *

+ * @param event Event being fired + */ public void afterAdminUnlockedUserEvent (@Observes final ObservableAdminUnlockedUserEvent event) { // event should not be null if (null == event) { @@ -280,7 +295,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getUnlockedUser(), "ADMIN_UNLOCKED_USER_ACCOUNT"); //NOI18N } - @Override + /** + * Event observer for updated user data by administrator + *

+ * @param event Event being updated + */ public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) { // event should not be null if (null == event) { @@ -301,7 +320,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getUpdatedUser(), "ADMIN_UPDATED_USER_PERSONAL_DATA"); //NOI18N } - @Override + /** + * Event observer when user confirmed account. + *

+ * @param event Event being fired + */ public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) { // event should not be null if (null == event) { @@ -322,7 +345,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getConfirmedUser(), "USER_CONFIRMED_ACCOUNT"); //NOI18N } - @Override + /** + * Event observer for logged-in user + *

+ * @param event Event being fired + */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { // event should not be null if (null == event) { @@ -343,7 +370,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getLoggedInUser(), "USER_LOGGED_IN"); //NOI18N } - @Override + /** + * Event observer for logged-out user + *

+ * @param event Event instance + */ public void afterUserLogoutEvent (@Observes final ObservableUserLogoutEvent event) { // event should not be null if (null == event) { @@ -364,7 +395,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getLoggedOutUser(), "USER_LOGGED_OUT"); //NOI18N } - @Override + /** + * Event observer for new user registrations + *

+ * @param event Event being fired + */ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { // event should not be null if (null == event) { @@ -385,7 +420,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getRegisteredUser(), "USER_REGISTERED_NEW_ACCOUNT"); //NOI18N } - @Override + /** + * Event observer for users resending their confirmation link + *

+ * @param event Event being fired + */ public void afterUserResendConfirmationLinkEvent (@Observes final ObservableUserResendLinkAccountEvent event) { // event should not be null if (null == event) { @@ -406,7 +445,12 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getResendLinkUser(), "USER_RESEND_CONFIRMATION_LINK"); //NOI18N } - @Override + /** + * Method being call after user's password has been updated (and history + * entry has been created). + *

+ * @param event Event being observed + */ public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) { // Check parameter if (null == event) { @@ -427,7 +471,11 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.addUserActivity(event.getPasswordHistory().getUserPasswordHistoryUser(), "USER_UPDATED_PASSWORD"); //NOI18N } - @Override + /** + * Listens to fired event when user updated personal data + *

+ * @param event Event being fired + */ public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) { // Check parameter if (null == event) { @@ -570,131 +618,4 @@ public abstract class JobsUserActivityWebApplicationBean extends BaseJobsControl this.usersActivity.get(userActivity.getActivityUser()).add(userActivity); } - /** - * Returns given property key or throws an exception if not found. - *

- * @param parameterKey Property key - *

- * @return Property value - *

- * @throws NullPointerException If given key is not found - * @throws NumberFormatException If no number is given in context parameter - */ - protected int getIntegerContextParameter (final String parameterKey) throws NullPointerException, NumberFormatException { - // Get context parameter - Integer contextValue = Integer.parseInt(this.getStringContextParameter(parameterKey)); - // Return it - return contextValue; - } - - /** - * Returns given property key or throws an exception if not found. - *

- * @param parameterKey Property key - *

- * @return Property value - *

- * @throws NullPointerException If given key is not found - */ - protected String getStringContextParameter (final String parameterKey) throws NullPointerException { - // Get context parameter - String contextValue = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(parameterKey); - // Is it null? - if (null == contextValue) { - // Throw NPE - throw new NullPointerException(MessageFormat.format("parameterKey={0} is not set.", parameterKey)); //NOI18N - } - // Return it - return contextValue; - } - - /** - * Checks whether debug mode is enabled for given controller - *

- * @param controllerName Name of controller - *

- * @return Whether debug mode is enabled - */ - protected boolean isDebugModeEnabled (final String controllerName) { - // Parameters should be valid - if (null == controllerName) { - // Throw NPE - throw new NullPointerException("controllerName is null"); //NOI18N - } else if (controllerName.isEmpty()) { - // Is empty - throw new IllegalArgumentException("controllerName is empty"); //NOI18N - } - // Try to get context parameter - String contextParameter = this.getStringContextParameter(String.format("is_debug_%s_enabled", controllerName)); //NOI18N - // Is it set and true? - boolean isEnabled = Boolean.parseBoolean(contextParameter) == Boolean.TRUE; - // Return it - return isEnabled; - } - - /** - * Loads resource bundle for given locale. This must be implemented per - * project so all projects can still customize their methods. Calling - * ResourceBundleloadBundle() in this class means that also the bundle files - * must be present here. - *

- * @param locale Locale from e.g. FacesContext - *

- * @return Initialized and loaded resource bundle - */ - protected abstract ResourceBundle loadResourceBundle (final Locale locale); - - /** - * Shows a faces message for given causing exception. The message from the - * exception is being inserted into the message. - *

- * @param clientId Client id to send message to - * @param cause Causing exception - */ - protected void showFacesMessage (final String clientId, final Throwable cause) { - // Get context and add message - this.showFacesMessage(clientId, cause.getMessage()); - } - - /** - * Shows a faces message with given message (i18n) key. - *

- * @param clientId Client id to send message to - * @param i18nKey Message key - *

- * @throws NullPointerException If clientId or i18nKey is null - * @throws IllegalArgumentException If clientId or i18nKey is empty - */ - protected void showFacesMessage (final String clientId, final String i18nKey) throws NullPointerException, IllegalArgumentException { - // Both parameter must be valid - if (null == clientId) { - // Throw NPE - throw new NullPointerException("clientId is null"); //NOI18N - } else if (clientId.isEmpty()) { - // Is empty - throw new IllegalArgumentException("clientId is null"); //NOI18N - } else if (null == i18nKey) { - // Throw NPE - throw new NullPointerException("i18nKey is null"); //NOI18N - } else if (i18nKey.isEmpty()) { - // Is empty - throw new IllegalArgumentException("i18nKey is null"); //NOI18N - } - // Get current locale - Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale(); - // Get bundle bundle - ResourceBundle bundle = this.loadResourceBundle(locale); - // Default is i18nKey - String message = MessageFormat.format("!{0}!", i18nKey); //NOI18N - // Try it - try { - // Get message - message = bundle.getString(i18nKey); - } catch (final MissingResourceException ex) { - // Did not find it, ignored - } - // Get context and add message - FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(message)); - } - } diff --git a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java index 5801699f..1a349957 100644 --- a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java +++ b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationController.java @@ -21,19 +21,6 @@ import java.util.List; import javax.ejb.Local; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.activity.LogableUserActivity; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; -import org.mxchange.jusercore.events.resendlink.ObservableUserResendLinkAccountEvent; -import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; -import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; -import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent; -import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; -import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; -import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent; -import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; -import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; /** * A controller (bean) interface for user activity log @@ -43,98 +30,6 @@ import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDa @Local public interface JobsUserActivityWebApplicationController extends Serializable { - /** - * Event observer for newly added users by adminstrator - *

- * @param event Event being fired - */ - void afterAdminAddedUserEvent (final ObservableAdminAddedUserEvent event); - - /** - * Event observer for deleted user accounts (by administrator) - *

- * @param event Event being fired - */ - void afterAdminDeletedUserEvent (final ObservableAdminDeletedUserEvent event); - - /** - * Event observer for linked users with existing contact data - *

- * @param event Event being fired - */ - void afterAdminLinkedUserEvent (final ObservableAdminLinkedUserEvent event); - - /** - * Event observer for locked users - *

- * @param event Event being fired - */ - void afterAdminLockedUserEvent (final ObservableAdminLockedUserEvent event); - - /** - * Event observer for unlocked users - *

- * @param event Event being fired - */ - void afterAdminUnlockedUserEvent (final ObservableAdminUnlockedUserEvent event); - - /** - * Event observer for updated user data by administrator - *

- * @param event Event being updated - */ - void afterAdminUpdatedUserDataEvent (final ObservableAdminUpdatedUserDataEvent event); - - /** - * Event observer when user confirmed account. - *

- * @param event Event being fired - */ - void afterUserConfirmedAccountEvent (final ObservableUserConfirmedAccountEvent event); - - /** - * Event observer for logged-out user - *

- * @param event Event instance - */ - void afterUserLogoutEvent (final ObservableUserLogoutEvent event); - - /** - * Method being call after user's password has been updated (and history - * entry has been created). - *

- * @param event Event being observed - */ - void afterUserUpdatedPasswordEvent (final ObservableUpdatedUserPasswordEvent event); - - /** - * Listens to fired event when user updated personal data - *

- * @param event Event being fired - */ - void afterUserUpdatedPersonalDataEvent (final ObservableUpdatedUserPersonalDataEvent event); - - /** - * Event observer for new user registrations - *

- * @param event Event being fired - */ - void afterUserRegistrationEvent (final ObservableUserRegisteredEvent event); - - /** - * Event observer for logged-in user - *

- * @param event Event being fired - */ - void afterUserLoginEvent (final ObservableUserLoggedInEvent event); - - /** - * Event observer for users resending their confirmation link - *

- * @param event Event being fired - */ - void afterUserResendConfirmationLinkEvent (final ObservableUserResendLinkAccountEvent event); - /** * Adds user activity entry with given type *

diff --git a/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java index 7a8c0d1e..40adc257 100644 --- a/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java @@ -34,13 +34,13 @@ import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; -import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent; -import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; +import org.mxchange.juserlogincore.events.confirmation.UserConfirmedAccountEvent; /** * A web request bean for confirmation link handling diff --git a/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebSessionBean.java index 2e4e0599..a14c96fb 100644 --- a/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebSessionBean.java @@ -32,11 +32,11 @@ import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController; import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; -import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress; import org.mxchange.jusercore.model.email_address.EmailAddressChange; import org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote; import org.mxchange.jusercore.model.user.User; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; /** * A web session-scoped bean for changing email addresses diff --git a/src/java/org/mxchange/jjobs/beans/user/login/JobsUserLoginWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/login/JobsUserLoginWebSessionBean.java index aa689e8e..53fd7dae 100644 --- a/src/java/org/mxchange/jjobs/beans/user/login/JobsUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/login/JobsUserLoginWebSessionBean.java @@ -34,24 +34,24 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; -import org.mxchange.jusercore.container.login.LoginContainer; -import org.mxchange.jusercore.container.login.UserLoginContainer; -import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent; -import org.mxchange.jusercore.events.login.UserLoggedInEvent; -import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent; -import org.mxchange.jusercore.events.logout.UserLogoutEvent; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; 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.UserUtils; import org.mxchange.jusercore.model.user.password_history.PasswordHistory; import org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.container.login.LoginContainer; +import org.mxchange.juserlogincore.container.login.UserLoginContainer; +import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; +import org.mxchange.juserlogincore.events.login.UserLoggedInEvent; +import org.mxchange.juserlogincore.events.logout.ObservableUserLogoutEvent; +import org.mxchange.juserlogincore.events.logout.UserLogoutEvent; +import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; +import org.mxchange.juserlogincore.login.UserLoginUtils; +import org.mxchange.juserlogincore.model.login.user.UserLoginSessionBeanRemote; /** * A web bean for user registration @@ -312,7 +312,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J LoginContainer container = new UserLoginContainer(this.getLoggedInUser(), this.getUserCurrentPassword()); // Now check if it matches - return UserUtils.ifPasswordMatches(container, this.getLoggedInUser()); + return UserLoginUtils.ifPasswordMatches(container, this.getLoggedInUser()); } @Override @@ -367,7 +367,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsController implements J // Check all passwords for (final PasswordHistory entry : this.getUserPasswordHistory()) { // Is password the same? - if (UserUtils.ifPasswordMatches(userPassword, entry.getUserPasswordHistoryUser())) { + if (UserLoginUtils.ifPasswordMatches(userPassword, entry.getUserPasswordHistoryUser())) { // Yes, found it isPasswordInHistory = true; break; diff --git a/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java index 0012ec36..9fba63ba 100644 --- a/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/password/JobsUserPasswordWebRequestBean.java @@ -31,16 +31,16 @@ import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController; import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; -import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserPasswordEvent; -import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent; 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.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; -import org.mxchange.jusercore.model.user.UserUtils; import org.mxchange.jusercore.model.user.password_history.PasswordHistory; +import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; +import org.mxchange.juserlogincore.events.user.password_change.UpdatedUserPasswordEvent; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; +import org.mxchange.juserlogincore.login.UserLoginUtils; /** * A user password (change) controller (bean) @@ -118,7 +118,7 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement } else if (!this.featureController.isFeatureEnabled("change_user_password")) { //NOI18N // Editing is not allowed throw new IllegalStateException("User tried to change password."); //NOI18N - } else if (!UserUtils.ifPasswordMatches(this.getUserCurrentPassword(), this.userLoginController.getLoggedInUser())) { + } else if (!UserLoginUtils.ifPasswordMatches(this.getUserCurrentPassword(), this.userLoginController.getLoggedInUser())) { // Password mismatches this.showFacesMessage("form_user_change_password:userCurrentPassword", "Entered current password does not matched stored password."); //NOI18N @@ -160,7 +160,7 @@ public class JobsUserPasswordWebRequestBean extends BaseJobsController implement User user = this.userLoginController.getLoggedInUser(); // Encrypt password - String encryptedPassword = UserUtils.encryptPassword(this.getUserPassword()); + String encryptedPassword = UserLoginUtils.encryptPassword(this.getUserPassword()); // Set it in user user.setUserEncryptedPassword(encryptedPassword); diff --git a/src/java/org/mxchange/jjobs/beans/user/register/JobsUserRegisterWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/register/JobsUserRegisterWebSessionBean.java index 0fe7d1eb..ece4b929 100644 --- a/src/java/org/mxchange/jjobs/beans/user/register/JobsUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/register/JobsUserRegisterWebSessionBean.java @@ -35,15 +35,15 @@ import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController; import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController; import org.mxchange.jjobs.beans.user.JobsAdminUserWebRequestController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; -import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent; -import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.exceptions.DataRepeatMismatchException; import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; import org.mxchange.jusercore.model.user.User; -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.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.juserlogincore.events.registration.UserRegisteredEvent; +import org.mxchange.juserlogincore.login.UserLoginUtils; +import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; /** * A web bean for user registration @@ -166,7 +166,7 @@ public class JobsUserRegisterWebSessionBean extends BaseJobsController implement throw new FaceletException(new DataRepeatMismatchException("Passwords not matching.")); //NOI18N } else if (this.userController.ifBothPasswordsEmptyAllowed()) { // Both passwords are left empty and is allowed, then generate a random password - randomPassword = UserUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + randomPassword = UserLoginUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); // Set it in both fields this.userController.setUserPassword(randomPassword); @@ -175,7 +175,7 @@ public class JobsUserRegisterWebSessionBean extends BaseJobsController implement } // Encrypt password - String encryptedPassword = UserUtils.encryptPassword(this.userController.getUserPassword()); + String encryptedPassword = UserLoginUtils.encryptPassword(this.userController.getUserPassword()); // Set it here user.setUserEncryptedPassword(encryptedPassword); @@ -255,7 +255,7 @@ public class JobsUserRegisterWebSessionBean extends BaseJobsController implement return ""; //NOI18N } else if (this.userController.ifBothPasswordsEmptyAllowed()) { // Both passwords are left empty and is allowed, then generate a random password - String randomPassword = UserUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + String randomPassword = UserLoginUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); // Set it in both fields this.userController.setUserPassword(randomPassword); diff --git a/src/java/org/mxchange/jjobs/beans/user/resendlink/JobsResendLinkWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/resendlink/JobsResendLinkWebSessionBean.java index 530698c7..74732530 100644 --- a/src/java/org/mxchange/jjobs/beans/user/resendlink/JobsResendLinkWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/resendlink/JobsResendLinkWebSessionBean.java @@ -30,15 +30,15 @@ import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; -import org.mxchange.jusercore.events.resendlink.ObservableUserResendLinkAccountEvent; -import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent; import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jusercore.model.user.resendlink.ResendLinkSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.juserlogincore.events.resendlink.ObservableUserResendLinkAccountEvent; +import org.mxchange.juserlogincore.events.resendlink.UserResendLinkAccountEvent; +import org.mxchange.juserlogincore.model.user.resendlink.ResendLinkSessionBeanRemote; /** * A web session-scoped bean for resending confirmation link