}
@Override
- public void afterUserConfirmedAccountEvent (@Observes final UserConfirmedAccountEvent event) {
+ public void afterUserConfirmedAccountEventEvent (@Observes final UserConfirmedAccountEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
}
@Override
- public void afterUserLogin (@Observes final UserLoggedInEvent event) {
+ public void afterUserLoginEvent (@Observes final UserLoggedInEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
* <p>
* @param event Event being fired
*/
- void afterUserConfirmedAccountEvent (final UserConfirmedAccountEvent event);
+ void afterUserConfirmedAccountEventEvent (final UserConfirmedAccountEvent event);
/**
* Event observer when a list with unused mobile numbers is being created
* <p>
* @param event Event instance
*/
- void afterUserLogin (final UserLoggedInEvent event);
+ void afterUserLoginEvent (final UserLoggedInEvent event);
/**
* Creates an instance from all properties
private Locale locale;
@Override
- public void afterUserLogin (@Observes final UserLoggedInEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("LandingLocalizationSessionBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
-
+ public void afterUserLoginEvent (@Observes final UserLoggedInEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
* <p>
* @param event Event instance
*/
- void afterUserLogin (final UserLoggedInEvent event);
+ void afterUserLoginEvent (final UserLoggedInEvent event);
/**
* Getter for locale
package org.mxchange.jjobs.beans.resendlink;
import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
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.ResendLinkUserAccountEvent;
+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.status.UserAccountStatus;
@Inject
private JobsUserWebSessionController userController;
+ /**
+ * Event being fired after confirmation link is being sent
+ */
+ @Inject
+ @Any
+ private Event<UserResendLinkAccountEvent> userResendLinkEvent;
+
/**
* Default constructor
*/
throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
}
- // Get base URL
- String baseUrl = FacesUtils.generateBaseUrl();
+ try {
+ // Get base URL
+ String baseUrl = FacesUtils.generateBaseUrl();
+
+ // Call EJB and return redirect target
+ this.emailBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+ } catch (final UserNotFoundException ex) {
+ // User not found
+ this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_NOT_FOUND"); //NOI18N
+ return ""; //NOI18N
+ } catch (final UserStatusLockedException | UserStatusConfirmedException ex) {
+ // Output message, this should not happen as the confirmation key is being removed
+ this.showFacesMessage("form_resend_link:resendEmailAddress", ex); //NOI18N
+ return ""; //NOI18N
+ }
- // Call EJB and return redirect target
- this.emailBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+ // Fire event
+ this.userResendLinkEvent.fire(new ResendLinkUserAccountEvent(user));
// Clear this bean
this.clear();
}
@Override
- public void afterUserConfirmedAccount (@Observes final UserConfirmedAccountEvent event) {
+ public void afterUserConfirmedAccountEvent (@Observes final UserConfirmedAccountEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
}
@Override
- public void afterUserLogin (@Observes final UserLoggedInEvent event) {
+ public void afterUserLoginEvent (@Observes final UserLoggedInEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
}
@Override
- public void afterUserUpdatedPersonalData (@Observes final UpdatedUserPersonalDataEvent event) {
+ public void afterUserUpdatedPersonalDataEvent (@Observes final UpdatedUserPersonalDataEvent event) {
// Check parameter
if (null == event) {
// Throw NPE
* <p>
* @param event Event being fired
*/
- void afterUserConfirmedAccount (final UserConfirmedAccountEvent event);
+ void afterUserConfirmedAccountEvent (final UserConfirmedAccountEvent event);
/**
* Method being call after user's password has been updated (and history
* <p>
* @param event Event being fired
*/
- void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
+ void afterUserUpdatedPersonalDataEvent (final UpdatedUserPersonalDataEvent event);
/**
* Event observer for new user registrations
* <p>
* @param event Event instance
*/
- void afterUserLogin (final UserLoggedInEvent event);
+ void afterUserLoginEvent (final UserLoggedInEvent event);
/**
* All users
import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
+import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
}
@Override
- public void afterUserConfirmedAccount (@Observes final UserConfirmedAccountEvent event) {
+ public void afterUserConfirmedAccountEvent (@Observes final UserConfirmedAccountEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
}
@Override
- public void afterUserLogin (@Observes final UserLoggedInEvent event) {
+ public void afterUserLoginEvent (@Observes final UserLoggedInEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
this.addUserActivity(event.getLoggedInUser(), "USER_LOGGED_IN"); //NOI18N
}
+ @Override
+ public void afterUserResendConfirmationLinkEvent (@Observes final UserResendLinkAccountEvent event) {
+ // event should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getResendLinkUser()== null) {
+ // Throw NPE again
+ throw new NullPointerException("event.resendLinkUser is null"); //NOI18N
+ } else if (event.getResendLinkUser().getUserId() == null) {
+ // userId is null
+ throw new NullPointerException("event.resendLinkUser.userId is null"); //NOI18N
+ } else if (event.getResendLinkUser().getUserId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getResendLinkUser(), event.getResendLinkUser().getUserId())); //NOI18N
+ }
+
+ // Copy all data to this bean
+ this.addUserActivity(event.getResendLinkUser(), "USER_RESEND_CONFIRMATION_LINK"); //NOI18N
+ }
+
@Override
public void afterUserUpdatedPasswordEvent (@Observes final UpdatedUserPasswordEvent event) {
// Check parameter
}
@Override
- public void afterUserUpdatedPersonalData (@Observes final UpdatedUserPersonalDataEvent event) {
+ public void afterUserUpdatedPersonalDataEvent (@Observes final UpdatedUserPersonalDataEvent event) {
// Check parameter
if (null == event) {
// Throw NPE
import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
+import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;