]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
An event is now fired after confirmation of the account has completed. This can be...
authorRoland Häder <roland@mxchange.org>
Thu, 19 May 2016 15:56:30 +0000 (17:56 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 21 May 2016 10:49:12 +0000 (12:49 +0200)
src/java/org/mxchange/pizzaapplication/beans/confirmlink/PizzaConfirmationLinkWebRequestBean.java

index 3a21f72c0c5daaaabf191f6ebe462d01a1e543ae..a5fba5a1911a7fb3007c0f39f370286e494bacb4 100644 (file)
@@ -21,6 +21,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
 import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -28,6 +30,8 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.confirmation.ConfirmedUserAccountEvent;
+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;
@@ -73,6 +77,13 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
        @Inject
        private PizzaUserWebSessionController userController;
 
+       /**
+        * Event being fired when a user has confirmed the account
+        */
+       @Inject
+       @Any
+       private Event<UserConfirmedAccountEvent> userConfirmedEvent;
+
        /**
         * Default constructor
         */
@@ -191,6 +202,9 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
                        throw new FaceletException(MessageFormat.format("Cannot confirm user account {0}", user.getUserName()), ex); //NOI18N
                }
 
+               // Fire event that the user has confirmed account
+               this.userConfirmedEvent.fire(new ConfirmedUserAccountEvent(updatedUser));
+
                // Set it again in helper
                this.beanHelper.setUser(updatedUser);
        }