From: Roland Haeder Date: Tue, 6 Oct 2015 12:10:03 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f06dc0b424d6f79edbab7db72ef9ee9ac647f3a9;p=jfinancials-war.git Continued: - the user bean (controller) needs to be updated after successful registration to bear the user id - added new template register_done.xhtml - removed companyName from bean as this will be handled differently - added birthday property - also doRegister() needs to return the updated user instance - more language internationalized - temporary set user account status to CONFIRMED for easier development - many more other imrovements ... :-( I hit commit to quickly. - updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index 116c3511..5fd68dc8 100644 Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index 60198aa1..83cf0fea 100644 Binary files a/lib/juser-lib.jar and b/lib/juser-lib.jar differ diff --git a/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java b/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java index 96270270..88cb0319 100644 --- a/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/login/UserLoginWebBean.java @@ -42,7 +42,7 @@ public class UserLoginWebBean implements UserLoginWebController { /** * Reemote register session bean */ - private UserLoginSessionBeanRemote login; + private UserLoginSessionBeanRemote loginBean; /** * User controller @@ -64,7 +64,7 @@ public class UserLoginWebBean implements UserLoginWebController { Context context = new InitialContext(); // Try to lookup - this.login = (UserLoginSessionBeanRemote) context.lookup("ejb/stateless-login"); //NOI18N + this.loginBean = (UserLoginSessionBeanRemote) context.lookup("ejb/stateless-login"); //NOI18N } catch (final NamingException ex) { // Continue to throw throw new FaceletException(ex); @@ -78,7 +78,7 @@ public class UserLoginWebBean implements UserLoginWebController { try { // Call bean - this.login.loginUser(user); + this.loginBean.loginUser(user); } catch (final UserNotFoundException | UserStatusLockedException | UserStatusUnconfirmedException ex) { // Throw again throw new FaceletException(ex); diff --git a/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebBean.java b/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebBean.java index 5c7b2667..77cfa372 100644 --- a/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebBean.java @@ -27,6 +27,7 @@ import org.mxchange.addressbook.beans.user.UserWebController; import org.mxchange.jusercore.exceptions.UserAlreadyRegisteredException; import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.status.UserAccountStatus; /** * A web bean for user registration @@ -40,7 +41,7 @@ public class UserRegisterWebBean implements UserRegisterWebController { /** * Reemote register session bean */ - private UserRegistrationSessionBeanRemote register; + private UserRegistrationSessionBeanRemote registerBean; /** * User controller @@ -62,7 +63,7 @@ public class UserRegisterWebBean implements UserRegisterWebController { Context context = new InitialContext(); // Try to lookup - this.register = (UserRegistrationSessionBeanRemote) context.lookup("ejb/stateless-register"); //NOI18N + this.registerBean = (UserRegistrationSessionBeanRemote) context.lookup("ejb/stateless-register"); //NOI18N } catch (final NamingException ex) { // Continue to throw throw new FaceletException(ex); @@ -70,13 +71,22 @@ public class UserRegisterWebBean implements UserRegisterWebController { } @Override - public void doRegister () { + public String doRegister () { // Get user instance User user = this.userController.createUserInstance(); + // For debugging/programming only: + user.setUserAccountStatus(UserAccountStatus.CONFIRMED); + try { // Call bean - this.register.registerUser(user); + User registeredUser = this.registerBean.registerUser(user); + + // Copy all data from registered->user + this.userController.copyUser(registeredUser); + + // All fine, redirect to proper page + return "register_done"; //NOI18N } catch (final UserAlreadyRegisteredException ex) { // Continue to throw throw new FaceletException(ex); diff --git a/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebController.java b/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebController.java index bd27c9b3..0b5ceb5c 100644 --- a/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebController.java +++ b/src/java/org/mxchange/addressbook/beans/register/UserRegisterWebController.java @@ -28,6 +28,8 @@ public interface UserRegisterWebController extends Serializable { /** * Registers the user, if not found. Otherwise this method should throw an * exception. + *

+ * @return Redirection target */ - public void doRegister (); + public String doRegister (); } diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java b/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java index 6f72ab67..5b0bdc27 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java @@ -16,6 +16,7 @@ */ package org.mxchange.addressbook.beans.user; +import java.util.Date; import javax.enterprise.context.SessionScoped; import javax.faces.view.facelets.FaceletException; import javax.inject.Named; @@ -44,6 +45,12 @@ public class UserWebBean implements UserWebController { private static final long serialVersionUID = 542_145_347_916L; /////////////////////// Properties ///////////////////// + + /** + * Birth day + */ + private Date birthday; + /** * Cellphone number */ @@ -59,11 +66,6 @@ public class UserWebBean implements UserWebController { */ private String comment; - /** - * Company name - */ - private String companyName; - /** * Country code */ @@ -99,6 +101,11 @@ public class UserWebBean implements UserWebController { */ private Short houseNumber; + /** + * User id + */ + private Long userId; + /** * Phone number */ @@ -149,6 +156,31 @@ public class UserWebBean implements UserWebController { } } + @Override + public void copyUser (final User user) { + // Copy all fields: + // - base data + this.setUserId(user.getUserId()); + this.setGender(user.getUserContact().getGender()); + this.setFirstName(user.getUserContact().getFirstName()); + this.setFamilyName(user.getUserContact().getFamilyName()); + this.setStreet(user.getUserContact().getStreet()); + this.setHouseNumber(user.getUserContact().getHouseNumber()); + this.setZipCode(user.getUserContact().getZipCode()); + this.setCity(user.getUserContact().getCity()); + this.setCountryCode(user.getUserContact().getCountryCode()); + + // - contact data + this.setPhoneNumber(user.getUserContact().getPhoneNumber()); + this.setCellphoneNumber(user.getUserContact().getCellphoneNumber()); + this.setFaxNumber(user.getUserContact().getFaxNumber()); + this.setEmailAddress(user.getUserContact().getEmailAddress()); + + // -- other data + this.setBirthday(user.getUserContact().getBirthday()); + this.setComment(user.getUserContact().getComment()); + } + @Override public User createUserInstance () { // User message @@ -162,7 +194,7 @@ public class UserWebBean implements UserWebController { user.setUserName(this.getUserName()); // Create new contact - Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName(), this.getCompanyName()); + Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName()); contact.setStreet(this.getStreet()); contact.setHouseNumber(this.getHouseNumber()); contact.setZipCode(this.getZipCode()); @@ -170,6 +202,7 @@ public class UserWebBean implements UserWebController { contact.setPhoneNumber(this.getPhoneNumber()); contact.setFaxNumber(this.getFaxNumber()); contact.setCellphoneNumber(this.getCellphoneNumber()); + contact.setBirthday(this.getBirthday()); contact.setComment(this.getComment()); // Set contact in user @@ -181,6 +214,16 @@ public class UserWebBean implements UserWebController { return user; } + @Override + public Date getBirthday () { + return birthday; + } + + @Override + public void setBirthday (final Date birthday) { + this.birthday = birthday; + } + @Override public String getCellphoneNumber () { return this.cellphoneNumber; @@ -211,16 +254,6 @@ public class UserWebBean implements UserWebController { this.comment = comment; } - @Override - public String getCompanyName () { - return this.companyName; - } - - @Override - public void setCompanyName (final String companyName) { - this.companyName = companyName; - } - @Override public String getCountryCode () { return this.countryCode; @@ -311,6 +344,16 @@ public class UserWebBean implements UserWebController { this.street = street; } + @Override + public Long getUserId () { + return this.userId; + } + + @Override + public void setUserId (final Long userId) { + this.userId = userId; + } + @Override public String getUserName () { return this.userName; diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java index c161b61a..7bef48a4 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java @@ -17,6 +17,7 @@ package org.mxchange.addressbook.beans.user; import java.io.Serializable; +import java.util.Date; import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jusercore.model.user.User; @@ -27,6 +28,13 @@ import org.mxchange.jusercore.model.user.User; */ public interface UserWebController extends Serializable { + /** + * Copies given user into the controller + *

+ * @param user User instance + */ + public void copyUser (final User user); + /** * Creates an instance from all properties *

@@ -34,6 +42,20 @@ public interface UserWebController extends Serializable { */ public User createUserInstance (); + /** + * Getter for birth day + *

+ * @return Birth day + */ + public Date getBirthday (); + + /** + * Setter for birth day + *

+ * @param birthday Birth day + */ + public void setBirthday (final Date birthday); + /** * Cellphone number *

@@ -76,6 +98,20 @@ public interface UserWebController extends Serializable { */ public void setComment (final String comment); + /** + * Getter for user id + *

+ * @return User id + */ + public Long getUserId (); + + /** + * Setter for user id + *

+ * @param userId User id + */ + public void setUserId (final Long userId); + /** * Getter for user name *

@@ -104,20 +140,6 @@ public interface UserWebController extends Serializable { */ public void setUserPassword (final String userPassword); - /** - * Company name - *

- * @return the companyName - */ - public String getCompanyName (); - - /** - * Company name - *

- * @param companyName the companyName to set - */ - public void setCompanyName (final String companyName); - /** * Country code *

diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 3b8d9d9a..54eea798 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -61,7 +61,6 @@ PRIVACY_POLICY_NOT_ACCEPTED_MESSAGE=Bitte den Datenschutzbestimmungen zustimmen. TERMS_NOT_ACCEPTED_MESSAGE=Bitte den AGBs zustimmen. PERSONAL_DATA_MINIMUM_NOTICE=Bitte geben Sie mindestens Name, Anschrift und Telefonnummer an. PERSONAL_DATA_GENDER=Anrede: -PERSONAL_DATA_COMPANY_NAME=Firmenname: PERSONAL_DATA_FIRST_NAME=Vorname: PERSONAL_DATA_FAMILY_NAME=Nachname: PERSONAL_DATA_STREET=Stra\u00dfe: @@ -109,3 +108,5 @@ BUTTON_USER_LOGIN=Einloggen BUTTON_CONTINUE_STEP_2=Weiter zu Schritt 2 GUEST_REGISTRATION_ENTER_USER_NAME=Benutzernamen eingeben: GUEST_REGISTRATION_USER_NAME_NOTICE=Der Benutzername darf nur einmal vorkommen. +LINK_GUEST_RESENT_CONFIRMATION_LINK=Nochmals den Best\u00e4tigungslink aussenden? +GUEST_REGISTRATION_COMPLETED=Die Anmeldung ist abgeschlossen und Ihr Account wartet auf Freischaltung. Es ist eine Email mit einem entsprechenden Best\u00e4tigungslink zu Ihnen unterwegs. Diesen m\u00fcssen Sie einmal anklicken oder in die Adresszeile des Browsers kopieren und dann aufrufen lassen. Danach ist Ihr Account freigegeben. diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 66f79f5e..2f6c7127 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -61,7 +61,6 @@ PRIVACY_POLICY_NOT_ACCEPTED_MESSAGE=Please accept our privacy policy. TERMS_NOT_ACCEPTED_MESSAGE=Please accept Terms&Conditions. PERSONAL_DATA_MINIMUM_NOTICE=Please enter at least your name, address and phone number. PERSONAL_DATA_GENDER=Salutation: -PERSONAL_DATA_COMPANY_NAME=Company name: PERSONAL_DATA_FIRST_NAME=First name: PERSONAL_DATA_FAMILY_NAME=Family name: PERSONAL_DATA_STREET=Street: @@ -109,3 +108,5 @@ BUTTON_USER_LOGIN=Login BUTTON_CONTINUE_STEP_2=Weiter zu Schritt 2 GUEST_REGISTRATION_ENTER_USER_NAME=Enter user name: GUEST_REGISTRATION_USER_NAME_NOTICE=The user name must only exist once. +LINK_GUEST_RESENT_CONFIRMATION_LINK=Resend again the confirmation link? +GUEST_REGISTRATION_COMPLETED=The registration is completed and your account is pending confirmation. An email has been sent to you. There you will find a confirmation link which you have to click once or copy it into your browser's address bar and call it. diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 92ee7866..dab47156 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -13,22 +13,22 @@ * - - user_register - /user/register.xhtml - index /index.xhtml - user_lost_passwd - /user/lost_passwd.xhtml + user_register + /user/register.xhtml user_login /user/login.xhtml + + user_lost_passwd + /user/lost_passwd.xhtml + terms /terms.xhtml @@ -45,19 +45,18 @@ logout /bye.xhtml - - admin_product - /admin/product.xhtml - - - admin_category - /admin/category.xhtml - admin_index /admin/index.xhtml + + /user/register.xhtml + + register_done + /user/register_done.xhtml + + /admin/admin_logout.xhtml diff --git a/web/WEB-INF/templates/guest/guest_personal_data.tpl b/web/WEB-INF/templates/guest/guest_personal_data.tpl index f5571468..4496e88d 100644 --- a/web/WEB-INF/templates/guest/guest_personal_data.tpl +++ b/web/WEB-INF/templates/guest/guest_personal_data.tpl @@ -25,18 +25,6 @@

-
-
- -
- -
- -
- -
-
-
diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index ddd10b75..f8273612 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -1,53 +1,69 @@ - Addressbook Application v1.0 - - javax.faces.PROJECT_STAGE - Development - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - + Addressbook Application v1.0 + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + 30 - - - faces/index.xhtml - - - Constraint1 - - loginArea - Login area - /llogin/* - - - User Authentication - user - - - - FORM - Loginbereich / Login area - - /user/login.xhtml - /user/login_error.xhtml - - - - A logged-in user that has previously registered himself/herself. - user - - - tpl - text/plain - + + + faces/index.xhtml + + + LoginConstraint + + loginArea + Login area + /llogin/* + + + User Authentication + user + + + + AdminConstraint + + admin + Administrative area + /admin/* + + + Admin authentication + admin + + + + FORM + Loginbereich / Login area + + /user/login.xhtml + /user/login_error.xhtml + + + + A logged-in user that has previously registered himself/herself. + user + + + tpl + text/plain + + + Administrativre rule + admin + diff --git a/web/user/register_done.xhtml b/web/user/register_done.xhtml new file mode 100644 index 00000000..5214611b --- /dev/null +++ b/web/user/register_done.xhtml @@ -0,0 +1,37 @@ + + + + + + #{msg.PAGE_TITLE_USER_REGISTER_DONE} + + + + + + + #{msg.SUB_TITLE_USER_REGISTER_DONE} + + + +
+ #{msg.GUEST_USER_REGISTRATION_COMPLETED} +
+ +
+ + + +
+
+ + + + +
+