- updating the user instance didn't work the previous way, first you need to copy the loginController.loggedInUser instance and then you can update all fields on it
- added generic template message_box.tpl
- added generic page login_data_saved.xhtml
- added missing navigation rules from login_change_foo.xhtml -> login_data_saved.xhtml
- added some new language strings
- added CSS classes for message box template
- changing email address requires you to enter twice your new email address (displaying old is missing)
<Scene Scope="Project" version="2">
<Scope Scope="Faces Configuration Only"/>
<Scope Scope="Project">
- <Node id="privacy.xhtml" x="900" y="450" zoom="true"/>
- <Node id="login/login_change_password.xhtml" x="1400" y="150" zoom="true"/>
- <Node id="user/register.xhtml" x="400" y="600" zoom="true"/>
- <Node id="login/login_all_applications.xhtml" x="650" y="150" zoom="true"/>
- <Node id="login/login_index.xhtml" x="650" y="300" zoom="true"/>
- <Node id="user/resend_link.xhtml" x="150" y="750" zoom="true"/>
- <Node id="login/login_add_addressbook.xhtml" x="900" y="600" zoom="true"/>
- <Node id="login/login_own_addressbooks.xhtml" x="1650" y="150" zoom="true"/>
- <Node id="admin/admin_logout.xhtml" x="400" y="750" zoom="true"/>
+ <Node id="login/login_change_password.xhtml" x="900" y="450" zoom="true"/>
+ <Node id="privacy.xhtml" x="150" y="900" zoom="true"/>
+ <Node id="login/login_data_saved.xhtml" x="400" y="300" zoom="true"/>
+ <Node id="user/register.xhtml" x="1150" y="150" zoom="true"/>
+ <Node id="login/login_all_applications.xhtml" x="650" y="750" zoom="true"/>
+ <Node id="login/login_add_addressbook.xhtml" x="150" y="600" zoom="true"/>
+ <Node id="user/resend_link.xhtml" x="650" y="600" zoom="true"/>
+ <Node id="login/login_index.xhtml" x="900" y="600" zoom="true"/>
+ <Node id="login/login_own_addressbooks.xhtml" x="1150" y="300" zoom="true"/>
<Node id="terms.xhtml" x="150" y="150" zoom="true"/>
- <Node id="user/user_list.xhtml" x="900" y="300" zoom="true"/>
- <Node id="bye.xhtml" x="650" y="750" zoom="true"/>
- <Node id="index.xhtml" x="400" y="450" zoom="true"/>
- <Node id="user/register_done.xhtml" x="1400" y="300" zoom="true"/>
- <Node id="user/user_profile.xhtml" x="1150" y="450" zoom="true"/>
- <Node id="login/login_change_personal_data.xhtml" x="150" y="300" zoom="true"/>
- <Node id="user/show_addressbook.xhtml" x="650" y="600" zoom="true"/>
- <Node id="imprint.xhtml" x="1150" y="300" zoom="true"/>
- <Node id="*" x="150" y="900" zoom="true"/>
- <Node id="user/login_error.xhtml" x="1150" y="150" zoom="true"/>
- <Node id="user/show_addressbook_entries.xhtml" x="400" y="900" zoom="true"/>
- <Node id="admin/admin_index.xhtml" x="150" y="450" zoom="true"/>
- <Node id="login/login_change_email_address.xhtml" x="400" y="150" zoom="true"/>
- <Node id="user/lost_passwd.xhtml" x="650" y="450" zoom="true"/>
- <Node id="user/login.xhtml" x="150" y="600" zoom="true"/>
- <Node id="login/login_edit_user_data.xhtml" x="400" y="300" zoom="true"/>
+ <Node id="admin/admin_logout.xhtml" x="400" y="900" zoom="true"/>
+ <Node id="user/user_list.xhtml" x="150" y="450" zoom="true"/>
+ <Node id="bye.xhtml" x="650" y="150" zoom="true"/>
+ <Node id="index.xhtml" x="650" y="300" zoom="true"/>
+ <Node id="user/register_done.xhtml" x="400" y="450" zoom="true"/>
+ <Node id="user/user_profile.xhtml" x="900" y="150" zoom="true"/>
+ <Node id="login/login_change_personal_data.xhtml" x="650" y="450" zoom="true"/>
+ <Node id="*" x="150" y="300" zoom="true"/>
+ <Node id="imprint.xhtml" x="400" y="600" zoom="true"/>
+ <Node id="user/show_addressbook.xhtml" x="150" y="750" zoom="true"/>
+ <Node id="user/login_error.xhtml" x="900" y="300" zoom="true"/>
+ <Node id="user/show_addressbook_entries.xhtml" x="1650" y="150" zoom="true"/>
+ <Node id="admin/admin_index.xhtml" x="1400" y="150" zoom="true"/>
+ <Node id="login/login_change_email_address.xhtml" x="1150" y="450" zoom="true"/>
+ <Node id="user/lost_passwd.xhtml" x="400" y="750" zoom="true"/>
+ <Node id="user/login.xhtml" x="400" y="150" zoom="true"/>
+ <Node id="login/login_edit_user_data.xhtml" x="1400" y="300" zoom="true"/>
</Scope>
<Scope Scope="All Faces Configurations"/>
</Scene>
// Get user instance
User user = this.loginController.getLoggedInUser();
+ // It should be there, so run some tests on it
+ assert (user instanceof User) : "Instance loginController.loggedInUser is null";
+ assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
+ assert (user.getUserId() > 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 all fields
- this.updateUserFromFields(user);
+ user.setUserProfileMode(this.getUserProfileMode());
+ user.getUserContact().setContactGender(this.getGender());
+ user.getUserContact().setContactFirstName(this.getFirstName());
+ user.getUserContact().setContactFamilyName(this.getFamilyName());
+ user.getUserContact().setContactStreet(this.getStreet());
+ user.getUserContact().setContactHouseNumber(this.getHouseNumber());
+ user.getUserContact().setContactZipCode(this.getZipCode());
+ user.getUserContact().setContactCity(this.getCity());
+ user.getUserContact().setContactCountry(this.getCountry());
+
+ // Is there a phone number?
+ if (user.getUserContact().getContactPhoneNumber() instanceof DialableLandLineNumber) {
+ // Yes, then update as well
+ user.getUserContact().getContactPhoneNumber().setPhoneAreaCode(this.getPhoneAreaCode());
+ user.getUserContact().getContactPhoneNumber().setPhoneNumber(this.getPhoneNumber());
+ }
+
+ // Is there a fax number?
+ if (user.getUserContact().getContactFaxNumber() instanceof DialableFaxNumber) {
+ // Yes, then update as well
+ user.getUserContact().getContactFaxNumber().setPhoneAreaCode(this.getFaxAreaCode());
+ user.getUserContact().getContactFaxNumber().setPhoneNumber(this.getFaxNumber());
+ }
+
+ // Is there a cellphone number?
+ if (user.getUserContact().getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
+ // Yes, then update as well
+ user.getUserContact().getContactCellphoneNumber().setCellphoneProvider(this.getCellphoneCarrier());
+ user.getUserContact().getContactCellphoneNumber().setPhoneNumber(this.getCellphoneNumber());
+ }
// Send it to the EJB
this.userBean.updateUserPersonalData(user);
// All fine
- return "login_personal_data_changed"; //NOI18N
+ return "login_data_saved"; //NOI18N
}
@Override
return Collections.unmodifiableList(this.visibleUserList);
}
- /**
- * Updates given user instance with all (updated) data from this controller
- * <p>
- * @param user User instance to to be updated
- */
- private void updateUserFromFields (final User user) {
- // Make sure it is valid
- if (null == user) {
- // Throw NPE
- throw new NullPointerException("user is null"); //NOI18N
- }
+ @Override
+ public User createUserInstance () {
+ // User message
+ //this.getLogger().logTrace("createUserInstance: CALLED!");
+
+ // Required personal data must be set
+ assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
+
+ // Create new user instance
+ User user = new LoginUser();
// Update all data ...
user.setUserName(this.getUserName());
// Set contact in user
user.setUserContact(contact);
- }
-
- @Override
- public User createUserInstance () {
- // User message
- //this.getLogger().logTrace("createUserInstance: CALLED!");
-
- // Required personal data must be set
- assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
-
- // Create new user instance
- User user = new LoginUser();
-
- // Update all fields
- this.updateUserFromFields(user);
// Trace message
//this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user));
-
// Return it
return user;
}
#TODO: Please fix German umlaut!
LOGIN_CHANGE_PERSONAL_DATA_TITLE=Persoenliche Daten aendern:
ERROR_CURRENT_PASSWORD_MISMATCHING=Ihr eingegebenes Passwort entspricht nicht dem aktuell gespeicherten Passwort.
+MESSAGE_BOX_TITLE=Hinweis:
+MESSAGE_BOX_PARAMETER_MESSAGE_EMPTY=Fehler: Parameter "message" nicht gesetzt.
+LOGIN_MESSAGE_DATA_SAVED=Daten wurden gespeichert.
+PAGE_TITLE_LOGIN_DATA_SAVED=Ihre Daten wurden gespeichert
+CONTENT_TITLE_LOGIN_DATA_SAVED=Daten wurden gespeichert:
BUTTON_CHANGE_PERSONAL_DATA=Change personal data
LOGIN_CHANGE_PERSONAL_DATA_TITLE=Change personal data:
ERROR_CURRENT_PASSWORD_MISMATCHING=Your entered password doesn't match the currently stored one.
+MESSAGE_BOX_TITLE=Notice:
+MESSAGE_BOX_PARAMETER_MESSAGE_EMPTY=Error: Parameter "message" not set.
+LOGIN_MESSAGE_DATA_SAVED=Data has been saved.
+PAGE_TITLE_LOGIN_DATA_SAVED=Your data has been saved
+CONTENT_TITLE_LOGIN_DATA_SAVED=Data has been saved:
<to-view-id>/login/login_change_personal_data.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/login/login_change_password.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>login_data_saved</from-outcome>
+ <to-view-id>/login/login_data_saved.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/login/login_change_email_address.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>login_data_saved</from-outcome>
+ <to-view-id>/login/login_data_saved.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/login/login_change_personal_data.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>login_data_saved</from-outcome>
+ <to-view-id>/login/login_data_saved.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ >
+
+ <div class="message_box">
+ <div class="message_header">
+ #{msg.MESSAGE_BOX_TITLE}
+ </div>
+
+ <ui:fragment id="output_message" rendered="#{not empty message}">
+ <div class="okay para">
+ #{message}
+ </div>
+ </ui:fragment>
+
+ <ui:fragment id="output_message" rendered="#{empty message}">
+ <div class="errors para">
+ #{msg.MESSAGE_BOX_PARAMETER_MESSAGE_EMPTY}
+ </div>
+ </ui:fragment>
+ </div>
+</html>
<div class="table_row">
<div class="table_left">
- <h:outputLabel for="emailAddress1" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL1}" />
+ <h:outputLabel for="emailAddress1" value="#{msg.LOGIN_CHANGE_EMAIL_ENTER_EMAIL1}" />
</div>
<div class="table_right">
<div class="table_row">
<div class="table_left">
- <h:outputLabel for="emailAddress2" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL2}" />
+ <h:outputLabel for="emailAddress2" value="#{msg.LOGIN_CHANGE_EMAIL_ENTER_EMAIL2}" />
</div>
<div class="table_right">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ >
+
+ <ui:composition template="/WEB-INF/templates/login/login_base.tpl">
+ <ui:define name="login_title">#{msg.PAGE_TITLE_LOGIN_DATA_SAVED}</ui:define>
+
+ <ui:define name="content_header">
+ #{msg.CONTENT_TITLE_LOGIN_DATA_SAVED}
+ </ui:define>
+
+ <ui:define name="content">
+ <ui:fragment rendered="#{loginController.isUserLoggedIn()}">
+ <ui:include id="message_box" src="/WEB-INF/templates/generic/message_box.tpl">
+ <ui:param name="message" value="#{msg.LOGIN_MESSAGE_DATA_SAVED}" />
+ </ui:include>
+ </ui:fragment>
+
+ <ui:fragment rendered="#{not loginController.isUserLoggedIn()}">
+ <ui:include id="login_only" class="login_only" src="/WEB-INF/templates/generic/user_not_logged_in.tpl" />
+ </ui:fragment>
+ </ui:define>
+ </ui:composition>
+</html>
padding-left: 5px;
}
-.table_header, .table_label {
+.table_header, .table_label, .message_header {
text-align: center;
font-weight: bold;
}
.warnings {
color: gold;
}
+
+.message_box {
+ width: 400px;
+}
+
+.message_header {
+ background-color: #036fab;
+}
+
+.okay {
+ color: #00aa00;
+}