- added base URL parameter + email delivery
Signed-off-by: Roland Häder <roland@mxchange.org>
} 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
// 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
// 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