]> git.mxchange.org Git - addressbook-mailer-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Mon, 29 Aug 2016 15:51:00 +0000 (17:51 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 9 Jun 2017 20:36:08 +0000 (22:36 +0200)
- added base URL parameter + email delivery

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java

index c3609277c97bacc8fe113ec276b60e2d03831979..ff8b1e3936ddcdcae7baff1d634b48537cf6741d 100644 (file)
@@ -158,6 +158,12 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                } else if (user.getUserConfirmKey() == null) {
                        // Throw NPE
                        throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
                } else if (user.getUserConfirmKey() == null) {
                        // Throw NPE
                        throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
+               } else if (null == baseUrl) {
+                       // Throw it again
+                       throw new NullPointerException("baseUrl is null"); //NOI18N
+               } else if (baseUrl.isEmpty()) {
+                       // Invalid parameter
+                       throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
                }
 
                // Update user status and remove confirmation key
                }
 
                // Update user status and remove confirmation key
@@ -613,11 +619,11 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        // User does not exist
                        throw new EJBException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N
                } else if (null == baseUrl) {
                        // User does not exist
                        throw new EJBException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N
                } else if (null == baseUrl) {
-                       // Abort here
-                       throw new NullPointerException("password is null"); //NOI18N
+                       // Throw it again
+                       throw new NullPointerException("baseUrl is null"); //NOI18N
                } else if (baseUrl.isEmpty()) {
                } else if (baseUrl.isEmpty()) {
-                       // Abort here
-                       throw new IllegalArgumentException("password is empty"); //NOI18N
+                       // Invalid parameter
+                       throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
                }
 
                // Call other method
                }
 
                // Call other method
@@ -635,6 +641,20 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                // Flush it to get id number back
                this.getEntityManager().flush();
 
                // Flush it to get id number back
                this.getEntityManager().flush();
 
+               // Init variable
+               Address emailAddress;
+
+               try {
+                       // Create email address and set
+                       emailAddress = new InternetAddress(updatedUser.getUserContact().getContactEmailAddress());
+               } catch (final AddressException ex) {
+                       // Throw again
+                       throw new EJBException(ex);
+               }
+
+               // Send email to user
+               this.sendEmail("User password change", "user_password_change", emailAddress, user, baseUrl); //NOI18N
+
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: entry.userPasswordHistoryId={1} - EXIT!", this.getClass().getSimpleName(), entry.getUserPasswordHistoryId())); //NOI18N
 
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: entry.userPasswordHistoryId={1} - EXIT!", this.getClass().getSimpleName(), entry.getUserPasswordHistoryId())); //NOI18N