From 1ca5f043e1ce77937f8dbd1fcfe9acaaa9db994d Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 10 Mar 2016 20:11:27 +0100 Subject: [PATCH] added methods for changing email address (partly unfinished) + updated jar(s) --- lib/juser-lib.jar | Bin 4112 -> 4141 bytes .../jjobs/beans/user/UserWebSessionBean.java | 48 +++++++++++++++++- .../beans/user/UserWebSessionController.java | 16 +++++- 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index e9610b7b5e6631e07a8b3214791e637e4363fc42..93248266d4eebd8afd5d1c428b3b196b1de2d19c 100644 GIT binary patch delta 319 zcmbQBuvURLz?+$ci-CcIfgxpn)WXF7#Nrs#K5FD zg9MOfV_;;EWMByJW@Hj!hP!{VGmizx1C#4`?7?n2z@rbQKLN!-e$eH00@Fpj9$t0Q3}EPXGV_ delta 290 zcmZ3hFhPMgz?+$ci-CcIfkCS`Z6dD*vnG(Tm=C6I$%CmsV8O}ij7A{tEnSr5Tas!7imkc|DBs+r?JA?G* z>l`9XlekYYa!x+YouSIW#30JR03^j2#DO#$10#b314Do}Ba;X-+=-JDcp%o#=CKD` zdzVKaO!M 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId()); + assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null"; + assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null"; + assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); + + // Update email address + user.getUserContact().setContactEmailAddress(this.getEmailAddress1()); + + // Call EJB + this.userBean.updateEmailAddress(user); + + // All fine + return "login_data_saved"; //NOI18N + } + @Override public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) { // Trace message @@ -833,6 +871,12 @@ public class UserWebSessionBean implements UserWebSessionController { (this.getCity() != null)); } + @Override + public boolean isRequiredChangeEmailAddressSet () { + return ((this.getEmailAddress1() != null) && + (this.getEmailAddress2() != null)); + } + @Override public boolean isSameEmailAddressEntered () { return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat())); diff --git a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java index 9b68c9c2..1794c3dc 100644 --- a/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java +++ b/src/java/org/mxchange/jjobs/beans/user/UserWebSessionController.java @@ -477,6 +477,13 @@ public interface UserWebSessionController extends Serializable { */ boolean isRequiredChangePersonalDataSet (); + /** + * Checks whether all required are set for changing email address + *

+ * @return Whether the required personal data is set + */ + boolean isRequiredChangeEmailAddressSet (); + /** * Checks whether same email addresses have been entered *

@@ -523,5 +530,12 @@ public interface UserWebSessionController extends Serializable { *

* @throws UserPasswordMismatchException If the entered password doesn't match */ - String doChangePersonalData () throws UserPasswordMismatchException; + String doChangePersonalData (); + + /** + * Changes logged-in user's email address if the current password matches. + *

+ * @return New target page + */ + String doChangeEmailAddress (); } -- 2.39.5