import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController;
import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent;
+import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
import org.mxchange.jusercore.events.user.helper.created.ObservableHelperCreatedUserEvent;
import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
return this.visibleUserList;
}
- @Override
- public void clearUserName () {
+ /**
+ * Event observer for when a user name should be cleared
+ * <p>
+ * @param event Event being fired
+ */
+ public void clearUserNameEvent (@Observes final ObservableClearUserNameEvent event) {
+ // Is it valid?
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null");
+ }
+
// Clear it
- this.setUserName(null);
+ this.clearUserName();
}
- @Override
- public void clearUserPasswords () {
- // Clear both
- this.setUserPassword(null);
- this.setUserPasswordRepeat(null);
+ /**
+ * Event observer for when both user passwords should be cleared
+ * <p>
+ * @param event Event being fired
+ */
+ public void clearUserPasswordEvent (@Observes final ObservableClearUserPasswordEvent event) {
+ // Is it valid?
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null");
+ }
+
+ // Clear it
+ this.clearUserPasswords();
}
@Override
this.clearUserPasswords();
}
+ /**
+ * Clears user name
+ */
+ private void clearUserName () {
+ // Clear it
+ this.setUserName(null);
+ }
+
+ /**
+ * Clears both user passwords
+ */
+ private void clearUserPasswords () {
+ // Clear both
+ this.setUserPassword(null);
+ this.setUserPasswordRepeat(null);
+ }
+
/**
* Copies given user into the controller
* <p>
import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
import org.mxchange.jfinancials.beans.user.FinancialsAdminUserWebRequestController;
import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController;
+import org.mxchange.jusercore.events.user.clear.password.ClearUserPasswordEvent;
+import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent;
+import org.mxchange.jusercore.events.user.clear.username.ClearUserNameEvent;
+import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
@Any
private Event<ObservableUpdatedUserPasswordEvent> userPasswordChangedEvent;
+ /**
+ * An event being fired when a user name should be cleared
+ */
+ @Inject
+ @Any
+ private Event<ObservableClearUserNameEvent> clearUserNameEvent;
+
+ /**
+ * An event being fired when a user password should be cleared
+ */
+ @Inject
+ @Any
+ private Event<ObservableClearUserPasswordEvent> clearUserPasswordEvent;
+
/**
* An event being fired when a new user has registered
*/
// User name is already used, should not happen here
throw new FaceletException(new UserNameAlreadyRegisteredException(user));
} else {
- // May happen here, reset field
- this.userController.clearUserName();
+ // May happen here, fire event
+ this.clearUserNameEvent.fire(new ClearUserNameEvent());
+
+ // Output message
this.showFacesMessage("form_register_single:userName", "ERROR_USER_NAME_ALREADY_USED"); //NOI18N
return ""; //NOI18N
}
throw new NullPointerException("user is null after createUserInstance() was called"); //NOI18N
} else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(user))) { //NOI18N
// User name is already used, so clear it
- this.userController.clearUserName();
+ this.clearUserNameEvent.fire(new ClearUserNameEvent());
+
+ // Output message
this.showFacesMessage("form_register_page1:userName", "ERROR_USER_NAME_ALREADY_USED"); //NOI18N
return ""; //NOI18N
} else if (!this.contactController.isSameEmailAddressEntered()) {
// Is multi-page enabled?
if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N
// Unset both
- this.userController.clearUserPasswords();
+ this.clearUserPasswordEvent.fire(new ClearUserPasswordEvent());
// Output faces message
this.showFacesMessage("form_register_page1:userPassword", "ERROR_USER_PASSWORD_EMPTY"); //NOI18N