From: Roland Häder Date: Thu, 12 May 2016 16:18:23 +0000 (+0200) Subject: Rewritten a lot: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f2e1921c403c89c1919abf67599f13b472637d2c;p=pizzaservice-war.git Rewritten a lot: - introduced isUserNameRequired() which should make it sure to have registrations with no user name and password. This also includes no login area (not possible) - the user then will get a random user name with format "userXXXXX" and a random password. So it is still possible that the "feature" login area for users can come back. - so no "recover password" is possible, too. Therefore such links can be removed from the menu. - introduced isMultiplePageEnabled() which is used as a "switch" between single-page and multiple-page registration - introduced isPublicUserProfileEnabled() which is used to disabled/enable the feature "public user profiles" which is sometimes not wanted ... - introduced isResendConfirmationLinkEnabled() which disabled the corresponding feature - showing a "choose profile-mode" while no public user profile is enabled makes no sense ... So better "hide" this option. - introduced general (abstract) controller BaseController which currently holds a method for checking if for a named controller debug mode is enabled - renamed doRegister() to doFinishRegistration() - removed no longer used i18n strings (they may have come back by cherry-picking) - registration page 1/2 should be "basicly finished" now, single is also available - index page is now jlandingpage-specific as registration page is in index.xhtml (careful, cherry-picking this!) - added controller method doRegisterMultiPage1() - added a lot more language strings - renamed variables - added context parameters for above new methods - added needed navigation cases (careful with cherry-picking again) - sorted imports (minor) - fixed i18n string (usage) Signed-off-by: Roland Häder Signed-off-by: Roland Häder --- diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index ddebaa54..e5fb087a 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -2,74 +2,75 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index e2fc3d27..01981fa7 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -153,6 +153,8 @@ LOGIN_NO_PASSWORD_MESSAGE=Sie haben kein Passwort eingegeben. LOGIN_NO_USER_NAME_MESSAGE=Sie haben keinen Benutzernamen eingegeben. USER_NOT_LOGGED_IN=Sie sind nicht angemeldet. LOGIN_OWN_PROFILE_INVISIBLE=Ihr Profil ist auf "durchsichtig" gestellt. +LINK_GUEST_LOGIN_LOST_PASSWORD=Passwort vergessen? +LINK_TITLE_GUEST_LOGIN_LOST_PASSWORD=Passwort wiederherstellen TABLE_HEADER_ERROR_USER_NOT_LOGGED_IN=Sie m\u00fcssen angemeldet sein USER_IS_NOT_LOGGED_IN_FULL=Damit diese Funktion nutzen k\u00f6nnen, m\u00fcssen Sie sich anmelden und in Ihren Account eingeloggt sein. LOGIN_EDIT_USER_DATA_TITLE=Was m\u00f6chten Sie \u00e4ndern? @@ -487,3 +489,13 @@ LINK_GUEST_PRIVACY_STATEMENTS=Datenschutzbestimmungen ADMIN_ADD_OR_ENTER_CONTACT_DATA=... oder geben Sie die Kontaktdaten des Recruiters ein: ADMIN_PERSONAL_DATA_EMAIL_ADDRESS=Email-Adresse: ERROR_CONTACT_ID_NOT_FOUND=Fehler: Kontaktdaten nicht gefunden. +GUEST_REGISTRATION_PAGE1_TITLE=Anmeldeseite 1 +GUEST_REGISTRATION_PAGE2_TITLE=Anmeldeseite 2 +BUTTON_CONTINUE_REGISTER_PAGE2=Weiter zur Anmeldeseite 2 +ERROR_GUEST_REGISTER_MULTIPLE_PAGE_NOT_ENABLED=Fehler: Mehrfach-Seite f\u00fcr Anmeldung nicht aktiv, bitte Link nicht aufrufen. +PAGE_TITLE_USER_REGISTER_PAGE2=Anmeldeseite 2 +CONTENT_TITLE_USER_REGISTER_PAGE2=Anmeldeseite 2: +ERROR_GUEST_USER_LOGIN_DEACTIVATED=Fehler: Der Benutzerbereich wurde administrativ deaktiviert (keine Benutzernamen bei Anmeldung). +ERROR_GUEST_USER_RECOVER_PASSWORD_DEACTIVATED=Fehler: Wiederherstellen des Passwortes wurde administrativ deaktiviert. +ERROR_GUEST_USER_RESEND_CONFIRMATION_DEACTIVATED=Fehler: Erneutes Aussenden des Best\u00e4tigungslinked ist administrativ deaktiviert. +ERROR_GUEST_USER_PROFILE_DEACTIVATED=Fehler: \u00d6ffentliche Benutzerprofile sind administrativ deaktiviert. diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index ff8e68cb..8acdba37 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -450,3 +450,13 @@ LINK_GUEST_PRIVACY_STATEMENTS=privacy statements ADMIN_ADD_OR_ENTER_CONTACT_DATA=... or enter the recruiter's contact data: ADMIN_PERSONAL_DATA_EMAIL_ADDRESS=Email address: ERROR_CONTACT_ID_NOT_FOUND=Error: contact data not found +GUEST_REGISTRATION_PAGE1_TITLE=Registration page 1 +GUEST_REGISTRATION_PAGE2_TITLE=Registration page 2 +BUTTON_CONTINUE_REGISTER_PAGE2=Continue to registration page 2 +ERROR_GUEST_REGISTER_MULTIPLE_PAGE_NOT_ENABLED=Error: Multiple registration page not active, please don't call this page. +PAGE_TITLE_USER_REGISTER_PAGE2=Register page 2 +CONTENT_TITLE_USER_REGISTER_PAGE2=Register page 2: +ERROR_GUEST_USER_LOGIN_DEACTIVATED=Error: User area is deactivated by administrators, no user name while registration. +ERROR_GUEST_USER_RECOVER_PASSWORD_DEACTIVATED=Error: password recovery is deactivated by administrators. +ERROR_GUEST_USER_RESEND_CONFIRMATION_DEACTIVATED=Error: Resending confirmation link is deactivated by administrators. +ERROR_GUEST_USER_PROFILE_DEACTIVATED=Error: Public user profiles are deactivated by administrators. diff --git a/src/java/org/mxchange/pizzaapplication/beans/BasePizzaController.java b/src/java/org/mxchange/pizzaapplication/beans/BasePizzaController.java new file mode 100644 index 00000000..dd426872 --- /dev/null +++ b/src/java/org/mxchange/pizzaapplication/beans/BasePizzaController.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.pizzaapplication.beans; + +import java.io.Serializable; +import javax.faces.context.FacesContext; + +/** + * A general controller + *

+ * @author Roland Haeder + */ +public abstract class BasePizzaController implements Serializable { + + /** + * Serial number + */ + private static final long serialVersionUID = 50_837_597_127_567_140L; + + /** + * Checks whether debug mode is enabled for given controller + *

+ * @param controllerName Name of controller + *

+ * @return Whether debug mode is enabled + */ + protected boolean isDebugModeEnabled (final String controllerName) { + // Parameters should be valid + if (null == controllerName) { + // Throw NPE + throw new NullPointerException("controllerName is null"); //NOI18N + } else if (controllerName.isEmpty()) { + // Is empty + throw new IllegalArgumentException("controllerName is empty"); //NOI18N + } + + // Try to get context parameter + String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(String.format("is_debug_%s_enabled", controllerName)); //NOI18N + + // Is it set and true? + boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.equals("true"))); //NOI18N + + // Return it + return isEnabled; + } + +} diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java index f61972e2..455fda21 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java @@ -32,6 +32,7 @@ import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote; import org.mxchange.jshopcore.model.basket.ShopBasket; import org.mxchange.jshopcore.model.basket.items.BasketItem; import org.mxchange.jshopcore.model.product.Product; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * A bean for the basket @@ -40,7 +41,7 @@ import org.mxchange.jshopcore.model.product.Product; */ @Named ("basketController") @SessionScoped -public class PizzaBasketWebSessionBean implements PizzaBasketWebSessionController { +public class PizzaBasketWebSessionBean extends BasePizzaController implements PizzaBasketWebSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java index e7a21692..6448a954 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java @@ -32,6 +32,7 @@ import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException; import org.mxchange.jshopcore.model.category.AdminCategorySessionBeanRemote; import org.mxchange.jshopcore.model.category.Category; import org.mxchange.jshopcore.model.category.ProductCategory; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * Main application class @@ -40,7 +41,7 @@ import org.mxchange.jshopcore.model.category.ProductCategory; */ @Named ("adminCategoryController") @RequestScoped -public class PizzaAdminCategoryWebRequestBean implements PizzaAdminCategoryWebRequestController { +public class PizzaAdminCategoryWebRequestBean extends BasePizzaController implements PizzaAdminCategoryWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java index d89f0f7d..ab1c69ae 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/PizzaCategoryWebApplicationBean.java @@ -31,6 +31,7 @@ import javax.naming.NamingException; import org.mxchange.jshopcore.events.category.AddedCategoryEvent; import org.mxchange.jshopcore.model.category.Category; import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * General (product) category controller @@ -39,7 +40,7 @@ import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote; */ @Named ("categoryController") @ApplicationScoped -public class PizzaCategoryWebApplicationBean implements PizzaCategoryWebApplicationController { +public class PizzaCategoryWebApplicationBean extends BasePizzaController implements PizzaCategoryWebApplicationController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java index 4e832255..ab7e6e41 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java @@ -37,6 +37,7 @@ import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.basket.AddableBasketItem; import org.mxchange.jshopcore.wrapper.CheckoutWrapper; import org.mxchange.jshopcore.wrapper.WrapableCheckout; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.basket.PizzaBasketWebSessionController; import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController; import org.mxchange.pizzaapplication.beans.customer.PizzaCustomerWebSessionController; @@ -49,7 +50,7 @@ import org.mxchange.pizzaapplication.beans.receipt.PizzaReceiptWebSessionControl */ @Named ("checkoutController") @SessionScoped -public class PizzaCheckoutWebSessionBean implements PizzaCheckoutWebSessionController { +public class PizzaCheckoutWebSessionBean extends BasePizzaController implements PizzaCheckoutWebSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java index dccf55e7..6fc50648 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaAdminContactWebRequestBean.java @@ -47,6 +47,7 @@ import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.helper.PizzaAdminWebRequestController; /** @@ -56,7 +57,7 @@ import org.mxchange.pizzaapplication.beans.helper.PizzaAdminWebRequestController */ @Named ("adminContactController") @RequestScoped -public class PizzaAdminContactWebRequestBean implements PizzaAdminContactWebRequestController { +public class PizzaAdminContactWebRequestBean extends BasePizzaController implements PizzaAdminContactWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java index 887b59b2..51a7f625 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java @@ -52,6 +52,7 @@ import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController; /** @@ -61,7 +62,7 @@ import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionControl */ @Named ("contactController") @SessionScoped -public class PizzaContactWebSessionBean implements PizzaContactWebSessionController { +public class PizzaContactWebSessionBean extends BasePizzaController implements PizzaContactWebSessionController { /** * Serial number @@ -173,12 +174,6 @@ public class PizzaContactWebSessionBean implements PizzaContactWebSessionControl */ private boolean isLandLineUnlinked; - /** - * Login bean (controller) - */ - @Inject - private PizzaUserLoginWebSessionController userLoginController; - /** * Phone number area code */ @@ -199,6 +194,12 @@ public class PizzaContactWebSessionBean implements PizzaContactWebSessionControl */ private String street; + /** + * Login bean (controller) + */ + @Inject + private PizzaUserLoginWebSessionController userLoginController; + /** * ZIP code */ diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java index 8690f7d2..862b7751 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java @@ -34,6 +34,7 @@ import org.mxchange.jcountry.data.CountrySingletonBeanRemote; import org.mxchange.jcountry.events.AdminAddedCountryEvent; import org.mxchange.jcountry.events.AdminEventCountryAdded; import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * An administrative country bean @@ -42,7 +43,7 @@ import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException; */ @Named ("adminCountryController") @RequestScoped -public class PizzaAdminCountryWebRequestBean implements PizzaAdminCountryWebRequestController { +public class PizzaAdminCountryWebRequestBean extends BasePizzaController implements PizzaAdminCountryWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java index 1e1bc4ac..43faccba 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java @@ -30,6 +30,7 @@ import javax.naming.NamingException; import org.mxchange.jcountry.data.Country; import org.mxchange.jcountry.data.CountrySingletonBeanRemote; import org.mxchange.jcountry.events.AdminAddedCountryEvent; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * A country bean @@ -38,7 +39,7 @@ import org.mxchange.jcountry.events.AdminAddedCountryEvent; */ @Named ("countryController") @ApplicationScoped -public class PizzaCountryWebApplicationBean implements PizzaCountryWebApplicationController { +public class PizzaCountryWebApplicationBean extends BasePizzaController implements PizzaCountryWebApplicationController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java index 9e51f31c..df11ef7f 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaAdminCustomerWebRequestBean.java @@ -35,6 +35,7 @@ import org.mxchange.jcustomercore.events.customer.added.CustomerAdminAddedEvent; import org.mxchange.jcustomercore.exceptions.CustomerAlreadyRegisteredException; import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jcustomercore.model.customer.status.CustomerAccountStatus; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController; import org.mxchange.pizzaapplication.beans.helper.PizzaAdminWebRequestController; import org.mxchange.pizzaapplication.model.customer.PizzaAdminCustomerSessionBeanRemote; @@ -47,7 +48,7 @@ import org.mxchange.pizzaapplication.model.customer.PizzaCustomer; */ @Named ("adminCustomerController") @RequestScoped -public class PizzaAdminCustomerWebRequestBean implements PizzaAdminCustomerWebRequestController { +public class PizzaAdminCustomerWebRequestBean extends BasePizzaController implements PizzaAdminCustomerWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java index 0b3d5456..632083a2 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java @@ -35,6 +35,7 @@ import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent; import org.mxchange.jcustomercore.events.customer.added.AdminAddedCustomerEvent; import org.mxchange.jcustomercore.model.customer.Customer; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController; import org.mxchange.pizzaapplication.model.customer.PizzaAdminCustomerSessionBeanRemote; @@ -45,7 +46,7 @@ import org.mxchange.pizzaapplication.model.customer.PizzaAdminCustomerSessionBea */ @Named ("customerController") @SessionScoped -public class PizzaCustomerWebSessionBean implements PizzaCustomerWebSessionController { +public class PizzaCustomerWebSessionBean extends BasePizzaController implements PizzaCustomerWebSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/email_address/PizzaEmailChangeWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/email_address/PizzaEmailChangeWebSessionBean.java index fff019e1..960c5bc1 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/email_address/PizzaEmailChangeWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/email_address/PizzaEmailChangeWebSessionBean.java @@ -32,6 +32,7 @@ import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress; import org.mxchange.jusercore.model.email_address.EmailAddressChange; import org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote; import org.mxchange.jusercore.model.user.User; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController; /** @@ -41,7 +42,7 @@ import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionControl */ @Named ("emailChangeController") @SessionScoped -public class PizzaEmailChangeWebSessionBean implements PizzaEmailChangeWebSessionController { +public class PizzaEmailChangeWebSessionBean extends BasePizzaController implements PizzaEmailChangeWebSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java index 28e2d20c..7b0938ed 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/gender/PizzaGenderWebApplicationBean.java @@ -21,6 +21,7 @@ import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jcontacts.contact.gender.GenderUtils; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * A gender bean (controller) @@ -29,7 +30,7 @@ import org.mxchange.jcontacts.contact.gender.GenderUtils; */ @Named ("genderController") @ApplicationScoped -public class PizzaGenderWebApplicationBean implements PizzaGenderWebApplicationController { +public class PizzaGenderWebApplicationBean extends BasePizzaController implements PizzaGenderWebApplicationController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java index 648cf36d..4496bfc5 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java @@ -21,7 +21,7 @@ import javax.annotation.PostConstruct; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import javax.inject.Named; -import org.mxchange.jcoreee.database.BaseDatabaseBean; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * A session bean for handling localization/internationalization changes. This @@ -33,7 +33,7 @@ import org.mxchange.jcoreee.database.BaseDatabaseBean; */ @Named ("localizationController") @SessionScoped -public class PizzaLocalizationSessionBean extends BaseDatabaseBean implements PizzaLocalizationSessionController { +public class PizzaLocalizationSessionBean extends BasePizzaController implements PizzaLocalizationSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java index e4d5ecb7..cab8d936 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/login/PizzaUserLoginWebSessionBean.java @@ -39,6 +39,7 @@ import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserUtils; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController; /** @@ -48,7 +49,7 @@ import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController; */ @Named ("loginController") @SessionScoped -public class PizzaUserLoginWebSessionBean implements PizzaUserLoginWebSessionController { +public class PizzaUserLoginWebSessionBean extends BasePizzaController implements PizzaUserLoginWebSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java index 4c2c3f47..1e008b35 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java @@ -35,6 +35,7 @@ import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException; import org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote; import org.mxchange.jphone.phonenumbers.mobileprovider.CellphoneProvider; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * Administrative bean (controller) for mobile provider @@ -43,7 +44,7 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; */ @Named ("adminMobileProviderController") @RequestScoped -public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileProviderWebRequestController { +public class PizzaAdminMobileProviderWebRequestBean extends BasePizzaController implements PizzaAdminMobileProviderWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java index ce478f68..26d84c58 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java @@ -30,6 +30,7 @@ import javax.naming.NamingException; import org.mxchange.jphone.events.AdminAddedMobileProviderEvent; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * A general bean for mobile providers @@ -38,7 +39,7 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBe */ @Named ("mobileProviderController") @SessionScoped -public class PizzaMobileProviderWebRequestBean implements PizzaMobileProviderWebRequestController { +public class PizzaMobileProviderWebRequestBean extends BasePizzaController implements PizzaMobileProviderWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminContactPhoneWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminContactPhoneWebRequestBean.java index 12ab8240..70d904f5 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/phone/PizzaAdminContactPhoneWebRequestBean.java @@ -30,6 +30,7 @@ import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote; import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * Administrative bean (controller) for contact's phone numbers @@ -38,7 +39,7 @@ import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; */ @Named ("adminContactPhoneController") @RequestScoped -public class PizzaAdminContactPhoneWebRequestBean implements PizzaAdminContactPhoneWebRequestController { +public class PizzaAdminContactPhoneWebRequestBean extends BasePizzaController implements PizzaAdminContactPhoneWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java index d477617b..a2d385d9 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java @@ -36,6 +36,7 @@ import org.mxchange.jshopcore.model.category.Category; import org.mxchange.jshopcore.model.product.AdminProductSessionBeanRemote; import org.mxchange.jshopcore.model.product.GenericProduct; import org.mxchange.jshopcore.model.product.Product; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * Main application class @@ -44,7 +45,7 @@ import org.mxchange.jshopcore.model.product.Product; */ @Named ("adminProductController") @RequestScoped -public class PizzaAdminProductWebRequestBean implements PizzaAdminProductWebRequestController { +public class PizzaAdminProductWebRequestBean extends BasePizzaController implements PizzaAdminProductWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java index a5ffce83..15c86826 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/PizzaProductWebApplicationBean.java @@ -30,6 +30,7 @@ import javax.naming.NamingException; import org.mxchange.jshopcore.events.product.AddedProductEvent; import org.mxchange.jshopcore.model.product.Product; import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * General product controller @@ -38,7 +39,7 @@ import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote; */ @Named ("productController") @ApplicationScoped -public class PizzaProductWebApplicationBean implements PizzaProductWebApplicationController { +public class PizzaProductWebApplicationBean extends BasePizzaController implements PizzaProductWebApplicationController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java index 64133a6f..85b82e56 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/profile/PizzaUserProfileWebRequestBean.java @@ -24,6 +24,7 @@ import javax.inject.Named; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController; import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController; @@ -34,7 +35,7 @@ import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController; */ @Named (value = "profileController") @RequestScoped -public class PizzaUserProfileWebRequestBean implements PizzaUserProfileWebRequestController { +public class PizzaUserProfileWebRequestBean extends BasePizzaController implements PizzaUserProfileWebRequestController { /** * Serial number @@ -56,24 +57,24 @@ public class PizzaUserProfileWebRequestBean implements PizzaUserProfileWebReques @Override public boolean isProfileLinkVisibleById (final Long userId) { // Init user instance - User u = null; + User user = null; try { // Try to get it - u = this.userController.lookupUserById(userId); + user = this.userController.lookupUserById(userId); } catch (final UserNotFoundException ex) { // Throw again throw new FaceletException(ex); } // Is it null? - if (null == u) { + if (null == user) { // Not found, not visible. return false; } // Ask other method - return this.isProfileLinkVisibleByUser(u); + return this.isProfileLinkVisibleByUser(user); } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/profilemode/PizzaProfileModeWebApplicationBean.java b/src/java/org/mxchange/pizzaapplication/beans/profilemode/PizzaProfileModeWebApplicationBean.java index e60ab41c..e2f057a0 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/profilemode/PizzaProfileModeWebApplicationBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/profilemode/PizzaProfileModeWebApplicationBean.java @@ -19,6 +19,7 @@ package org.mxchange.pizzaapplication.beans.profilemode; import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * A profile mode bean @@ -27,7 +28,7 @@ import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; */ @Named ("profileModeController") @ApplicationScoped -public class PizzaProfileModeWebApplicationBean implements PizzaProfileModeWebApplicationController { +public class PizzaProfileModeWebApplicationBean extends BasePizzaController implements PizzaProfileModeWebApplicationController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java index 5ed9f623..40f9823f 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java @@ -24,6 +24,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote; +import org.mxchange.pizzaapplication.beans.BasePizzaController; /** * Checkout controller @@ -32,7 +33,7 @@ import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote; */ @Named ("receiptController") @SessionScoped -public class PizzaReceiptWebSessionBean implements PizzaReceiptWebSessionController { +public class PizzaReceiptWebSessionBean extends BasePizzaController implements PizzaReceiptWebSessionController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java index c0fc0af8..df60314e 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionBean.java @@ -20,6 +20,7 @@ import java.text.MessageFormat; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.enterprise.inject.Any; +import javax.faces.context.FacesContext; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; @@ -35,6 +36,7 @@ import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserUtils; import org.mxchange.jusercore.model.user.status.UserAccountStatus; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController; import org.mxchange.pizzaapplication.beans.user.PizzaAdminUserWebRequestController; import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController; @@ -46,7 +48,7 @@ import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController; */ @Named ("registerController") @SessionScoped -public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSessionController { +public class PizzaUserRegisterWebSessionBean extends BasePizzaController implements PizzaUserRegisterWebSessionController { /** * Serial number @@ -100,14 +102,14 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess } @Override - public String doRegister () { + public String doFinishRegistration () { // Get user instance User user = this.userController.createUserInstance(); // Is the user already used? if (null == user) { // user must be set - throw new NullPointerException("user is null"); //NOI18N + throw new NullPointerException("user is null after createUserInstance() was called"); //NOI18N } else if (!this.userController.isRequiredPersonalDataSet()) { // Not all required fields are set throw new FaceletException("Not all required fields are set."); //NOI18N @@ -131,8 +133,14 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess // Set it here user.setUserEncryptedPassword(encryptedPassword); - // For debugging/programming only: - user.setUserAccountStatus(UserAccountStatus.CONFIRMED); + // Is developer mode? + if (this.isDebugModeEnabled("register")) { //NOI18N + // For debugging/programming only: + user.setUserAccountStatus(UserAccountStatus.CONFIRMED); + } else { + // No debugging of this part + user.setUserAccountStatus(UserAccountStatus.UNCONFIRMED); + } try { // Call bean @@ -152,4 +160,34 @@ public class PizzaUserRegisterWebSessionBean implements PizzaUserRegisterWebSess } } + @Override + public String doRegisterMultiPage1 () { + // Now only redirect to next page as the JSF does it + return "register_page2"; //NOI18N + } + + @Override + public boolean isMultiplePageEnabled () { + // Get context parameter + String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_multi_register_page"); //NOI18N + + // Is it set? + boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N + + // Return value + return isEnabled; + } + + @Override + public boolean isResendConfirmationLinkEnabled () { + // Get context parameter + String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_resend_confirm_link_enabled"); //NOI18N + + // Is it set? + boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N + + // Return value + return isEnabled; + } + } diff --git a/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionController.java index e9c960ff..fdd0d7bc 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/register/PizzaUserRegisterWebSessionController.java @@ -31,6 +31,29 @@ public interface PizzaUserRegisterWebSessionController extends Serializable { *

* @return Redirection target */ - String doRegister (); + String doFinishRegistration (); + + /** + * Handles registration request send from first page. The (maybe) entered + * user name and email address is not used and that privacy and T&C are + * accepted. + *

+ * @return Redirect + */ + String doRegisterMultiPage1 (); + + /** + * Checks wether multi-page or single-page registration is active + *

+ * @return Whether multi (true) or single page (false) is active + */ + boolean isMultiplePageEnabled (); + + /** + * Checks whether the "resend confirmation link" feature is enabled + *

+ * @return Whether "resend confirmation link" is enabled + */ + boolean isResendConfirmationLinkEnabled (); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java index 35f814dc..c6785841 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java @@ -16,6 +16,7 @@ */ package org.mxchange.pizzaapplication.beans.user; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import java.text.MessageFormat; import java.util.Objects; import javax.annotation.PostConstruct; @@ -57,7 +58,7 @@ import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionControl */ @Named ("adminUserController") @RequestScoped -public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestController { +public class PizzaAdminUserWebRequestBean extends BasePizzaController implements PizzaAdminUserWebRequestController { /** * Serial number diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java index 1e95d03e..105f9ddc 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java @@ -26,6 +26,7 @@ import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Event; import javax.enterprise.event.Observes; import javax.enterprise.inject.Any; +import javax.faces.context.FacesContext; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; @@ -34,6 +35,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; +import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -45,9 +47,12 @@ import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; +import org.mxchange.jusercore.model.user.UserUtils; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; +import org.mxchange.pizzaapplication.beans.BasePizzaController; import org.mxchange.pizzaapplication.beans.contact.PizzaContactWebSessionController; import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController; +import org.mxchange.pizzaapplication.beans.register.PizzaUserRegisterWebSessionController; /** * A user bean (controller) @@ -56,7 +61,7 @@ import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionControl */ @Named ("userController") @SessionScoped -public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { +public class PizzaUserWebSessionBean extends BasePizzaController implements PizzaUserWebSessionController { /** * Serial number @@ -80,6 +85,13 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { @Inject private PizzaUserLoginWebSessionController loginController; + /** + * Registration controller + */ + @Inject + private PizzaUserRegisterWebSessionController + registerController; + /** * A list of all selectable contacts */ @@ -163,6 +175,27 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { } } + @Override + public void afterAdminAddedContact (@Observes final AdminAddedContactEvent event) { + // The event must be valid + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getAddedContact() == null) { + // Throw again ... + throw new NullPointerException("event.addedContact is null"); //NOI18N + } else if (event.getAddedContact().getContactId() == null) { + // ... and again + throw new NullPointerException("event.addedContact.customerId is null"); //NOI18N + } else if (event.getAddedContact().getContactId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("event.addedContact.customerId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N //NOI18N + } + + // Call other method + this.selectableContacts.add(event.getAddedContact()); + } + @Override public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent event) { // Trace message @@ -351,7 +384,24 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { // Create new user instance User localUser = new LoginUser(); - // Update all data ... + // Is user name required? + if (!this.isUserNameRequired()) { + // Generate pseudo-random user name + String randomName = this.userBean.generateRandomUserName(); + + // Set it and inivisible profile + this.setUserName(randomName); + this.setUserProfileMode(ProfileMode.INVISIBLE); + + // Generate random password + String randomPassword = UserUtils.createRandomPassword(PizzaUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + + // Set random password + this.setUserPassword(randomPassword); + this.setUserPasswordRepeat(randomPassword); + } + + // Set user name and mode localUser.setUserName(this.getUserName()); localUser.setUserProfileMode(this.getUserProfileMode()); @@ -586,6 +636,24 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { return isFound; } + @Override + public boolean isPublicUserProfileEnabled () { + // Get context parameter + String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_public_profile_enabled"); //NOI18N + + // Is it set? + boolean isPublicUserProfileEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N + + // This requires user names being enabled, too. + if ((isPublicUserProfileEnabled) && (!this.isUserNameRequired())) { + // Not valid state, users must be able to modify their profile, especially when it is public + throw new IllegalStateException("Public user profiles are enabled but user name requirement is disabled, this is not possible."); //NOI18N + } + + // Return value + return isPublicUserProfileEnabled; + } + @Override public boolean isRequiredChangePersonalDataSet () { return ((this.getUserProfileMode() != null) && @@ -595,11 +663,17 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { @Override public boolean isRequiredPersonalDataSet () { - return ((this.getUserName() != null) && - (this.getUserProfileMode() != null) && - (this.contactController.isRequiredPersonalDataSet()) && - (this.getUserPassword() != null) && - (this.getUserPasswordRepeat() != null)); + if (this.registerController.isMultiplePageEnabled()) { + // Multiple registration page + return this.contactController.isRequiredPersonalDataSet(); + } else { + // Single registration page + return (((this.getUserName() != null) || (!this.isUserNameRequired())) && + (this.getUserProfileMode() != null) && + (this.contactController.isRequiredPersonalDataSet()) && + (this.getUserPassword() != null) && + (this.getUserPasswordRepeat() != null)); + } } @Override @@ -617,6 +691,18 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName()))); } + @Override + public boolean isUserNameRequired () { + // Get context parameter + String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_name_required"); //NOI18N + + // Is it set? + boolean isUserNameRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N + + // Return value + return isUserNameRequired; + } + @Override public boolean isVisibleUserFound () { return ((this.visibleUserList instanceof List) && (this.visibleUserList.size() > 0)); diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java index 1821a808..ff5d8b50 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java @@ -19,6 +19,7 @@ package org.mxchange.pizzaapplication.beans.user; import java.io.Serializable; import java.util.List; import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -40,6 +41,14 @@ public interface PizzaUserWebSessionController extends Serializable { */ public static final Integer MINIMUM_PASSWORD_LENGTH = 5; + /** + * Observes events being fired when an administrator has added a new + * contact. + *

+ * @param event Event being fired + */ + void afterAdminAddedContact (final AdminAddedContactEvent event); + /** * Event observer for newly added users by adminstrator *

@@ -262,4 +271,20 @@ public interface PizzaUserWebSessionController extends Serializable { */ String doChangePersonalData (); + /** + * Checks whether this application requires a user name to be entered. + * Otherwise a random name like "userXXXXX" is generated + *

+ * @return Whether this application requires a user name + */ + boolean isUserNameRequired (); + + /** + * Checks wether public user profiles are enabled. This requires that user + * names are also enabled. + *

+ * @return Whether public user profiles are enabled + */ + boolean isPublicUserProfileEnabled (); + } diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 3814d681..7754be67 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -106,6 +106,10 @@ register_done /guest/user/register_done.xhtml + + register_page2 + /guest/user/register_page2.xhtml + /admin/admin_logout.xhtml diff --git a/web/WEB-INF/templates/contact/form_contact_data.tpl b/web/WEB-INF/templates/contact/form_contact_data.tpl index dd605687..55d2234c 100644 --- a/web/WEB-INF/templates/contact/form_contact_data.tpl +++ b/web/WEB-INF/templates/contact/form_contact_data.tpl @@ -188,31 +188,33 @@ -

-
- #{msg.USER_PROFILE_LEGEND} - -
-
- -
- -
- -
- -
-
- -
-
-
    -
  • #{msg.SELECTION_NOTICE_USER_PROFILE_MODE_INVISIBLE}
  • -
  • #{msg.SELECTION_NOTICE_USER_PROFILE_MODE_MEMBERS}
  • -
  • #{msg.SELECTION_NOTICE_USER_PROFILE_MODE_PUBLIC}
  • -
-
-
-
-
+ +
+
+ #{msg.USER_PROFILE_LEGEND} + +
+
+ +
+ +
+ +
+ +
+
+ +
+
+
    +
  • #{msg.SELECTION_NOTICE_USER_PROFILE_MODE_INVISIBLE}
  • +
  • #{msg.SELECTION_NOTICE_USER_PROFILE_MODE_MEMBERS}
  • +
  • #{msg.SELECTION_NOTICE_USER_PROFILE_MODE_PUBLIC}
  • +
+
+
+
+
+
diff --git a/web/WEB-INF/templates/guest/guest_menu.tpl b/web/WEB-INF/templates/guest/guest_menu.tpl index 3a5153f7..4b00f1c5 100644 --- a/web/WEB-INF/templates/guest/guest_menu.tpl +++ b/web/WEB-INF/templates/guest/guest_menu.tpl @@ -26,17 +26,27 @@
    -
  • - -
  • + +
  • + +
  • +
  • -
  • - -
  • + +
  • + +
  • +
    + + +
  • + +
  • +
diff --git a/web/WEB-INF/templates/guest/guest_privacy_terms.tpl b/web/WEB-INF/templates/guest/guest_privacy_terms.tpl index e4b3f398..385dfc85 100644 --- a/web/WEB-INF/templates/guest/guest_privacy_terms.tpl +++ b/web/WEB-INF/templates/guest/guest_privacy_terms.tpl @@ -34,7 +34,7 @@
#{msg.GUEST_AGREE_READ_TERMS_CONDITIONS_1} - + #{msg.GUEST_AGREE_READ_TERMS_CONDITIONS_2}
diff --git a/web/WEB-INF/templates/guest/user/guest_registration_form.tpl b/web/WEB-INF/templates/guest/user/guest_registration_form.tpl index 1331e0ef..e8d70a76 100644 --- a/web/WEB-INF/templates/guest/user/guest_registration_form.tpl +++ b/web/WEB-INF/templates/guest/user/guest_registration_form.tpl @@ -5,11 +5,10 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - - +
- #{msg.GUEST_REGISTRATION_TITLE} + #{msg.GUEST_REGISTRATION_PAGE2_TITLE}
@@ -93,7 +92,7 @@
diff --git a/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl b/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl index 55c2ebdd..a1c7223d 100644 --- a/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl +++ b/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl @@ -6,29 +6,29 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - +
- #{msg.GUEST_REGISTRATION_TITLE} + #{msg.GUEST_REGISTRATION_PAGE1_TITLE}
- -
#{msg.GUEST_REGISTRATION_EMAIL_LEGEND} -
-
- -
+ +
+
+ +
-
- -
+
+ +
-
-
+
+
+
@@ -54,35 +54,37 @@
-
+ +
-
-
- -
+
+
+ +
-
- +
+ +
+ +
-
-
+
+
+ +
-
-
- -
+
+ +
-
- +
-
-
- -
- #{msg.GUEST_REGISTRATION_USER_NAME_NOTICE} -
+
+ #{msg.GUEST_REGISTRATION_USER_NAME_NOTICE} +
+
@@ -90,7 +92,7 @@
diff --git a/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl b/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl new file mode 100644 index 00000000..d4e1e9d8 --- /dev/null +++ b/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl @@ -0,0 +1,100 @@ + + + + +
+
+ #{msg.GUEST_REGISTRATION_TITLE} +
+ + + +
+
+ #{msg.GUEST_REGISTRATION_EMAIL_LEGEND} + + +
+
+ +
+ +
+ +
+ +
+
+
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+
+ + +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ #{msg.GUEST_REGISTRATION_USER_NAME_NOTICE} +
+
+
+
+ + + + +
+
+
diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 0a3b07d3..7cee705d 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -3,8 +3,29 @@ An online address book application to share private and business memebers between all members. It is also possible that the user's profile can be made visible to outside. JLandingPage Application v1.0 - javax.faces.PROJECT_STAGE - Development + Whether debug mode is for registration controller enabled. + is_debug_register_enabled + false + + + Whether the multi-page registration page or a single registration page is active + is_multi_register_page + true + + + Whether a user name is required on registration + is_user_name_required + false + + + Whether the public user profile is enabled. + is_public_profile_enabled + false + + + Whether "resend confirmation link" ius enabled. + is_resend_confirm_link_enabled + false Faces Servlet diff --git a/web/customer/empty_basket.xhtml b/web/customer/empty_basket.xhtml index 956a6edd..770172b2 100644 --- a/web/customer/empty_basket.xhtml +++ b/web/customer/empty_basket.xhtml @@ -16,7 +16,13 @@ - Here goes your content. + + Here goes your content. + + + + + diff --git a/web/guest/user/login.xhtml b/web/guest/user/login.xhtml index 90ee53ce..5d90669c 100644 --- a/web/guest/user/login.xhtml +++ b/web/guest/user/login.xhtml @@ -16,18 +16,24 @@ -
- - Noch kein Kunde? Einfach beim Bestellen anmelden oder hier anmelden. -
+ +
+ + Noch kein Benutzerkonto? Einfach hier anmelden. +
-
- -
+
+ +
-
- -
+
+ +
+
+ + + +
diff --git a/web/guest/user/lost_passwd.xhtml b/web/guest/user/lost_passwd.xhtml index 0d088f3e..1890b69d 100644 --- a/web/guest/user/lost_passwd.xhtml +++ b/web/guest/user/lost_passwd.xhtml @@ -16,53 +16,59 @@ -
- -
-
- #{msg.GUEST_LOST_PASSWORD_TITLE} -
+ +
+ +
+
+ #{msg.GUEST_LOST_PASSWORD_TITLE} +
-
- #{msg.GUEST_LOST_PASSWORD_LEGEND} +
+ #{msg.GUEST_LOST_PASSWORD_LEGEND} -
-
- +
+
+ +
+ +
+ +
+ +
-
- +
+ #{msg.GUEST_LOST_PASSWORD_NUMBER_OR_EMAIL}
-
-
+
+
+ +
-
- #{msg.GUEST_LOST_PASSWORD_NUMBER_OR_EMAIL} -
+
+ +
-
-
- +
-
- -
+
-
+ - -
- - -
-
-
+ +
+ + + + + diff --git a/web/guest/user/register.xhtml b/web/guest/user/register.xhtml index ab0f9104..e8546fec 100644 --- a/web/guest/user/register.xhtml +++ b/web/guest/user/register.xhtml @@ -3,10 +3,10 @@ + xmlns:ui="http://xmlns.jcp.org/jsf/facelets" + xmlns:h="http://xmlns.jcp.org/jsf/html" + xmlns:f="http://xmlns.jcp.org/jsf/core" + > #{msg.PAGE_TITLE_USER_REGISTER} @@ -16,14 +16,22 @@ -
- #{msg.GUEST_ALREADY_USER_CONTINUE_LOGIN_1} - - #{msg.GUEST_ALREADY_USER_CONTINUE_LOGIN_2} -
+ +
+ #{msg.GUEST_ALREADY_USER_CONTINUE_LOGIN_1} + + #{msg.GUEST_ALREADY_USER_CONTINUE_LOGIN_2} +
+
- + + + + + + +
diff --git a/web/guest/user/register_page2.xhtml b/web/guest/user/register_page2.xhtml new file mode 100644 index 00000000..04b7ccd2 --- /dev/null +++ b/web/guest/user/register_page2.xhtml @@ -0,0 +1,38 @@ + + + + + + #{msg.PAGE_TITLE_USER_REGISTER_PAGE2} + + + #{msg.CONTENT_TITLE_USER_REGISTER_PAGE2} + + + + + +
+ #{msg.GUEST_ALREADY_USER_CONTINUE_LOGIN_1} + + #{msg.GUEST_ALREADY_USER_CONTINUE_LOGIN_2} +
+
+ +
+ +
+
+ + + + +
+
+ diff --git a/web/guest/user/user_profile.xhtml b/web/guest/user/user_profile.xhtml index 59d00852..cf4e580c 100644 --- a/web/guest/user/user_profile.xhtml +++ b/web/guest/user/user_profile.xhtml @@ -24,22 +24,28 @@ - - - + + + + + + + #{msg.ERROR_PROFILE_NOT_VISIBLE} + - - #{msg.ERROR_PROFILE_NOT_VISIBLE} + +
+ + + #{msg.PUBLIC_USER_PROFILE} + + +
+
- -
- - - #{msg.PUBLIC_USER_PROFILE} - - -
+ +