[seam-commits] Seam SVN: r13200 - in examples/trunk/booking-simplified/src/main: resources and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jun 16 17:39:18 EDT 2010


Author: lincolnthree
Date: 2010-06-16 17:39:17 -0400 (Wed, 16 Jun 2010)
New Revision: 13200

Modified:
   examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/PasswordConfirmValidator.java
   examples/trunk/booking-simplified/src/main/resources/messages.properties
   examples/trunk/booking-simplified/src/main/webapp/home.xhtml
Log:


Modified: examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/PasswordConfirmValidator.java
===================================================================
--- examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/PasswordConfirmValidator.java	2010-06-16 21:32:58 UTC (rev 13199)
+++ examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/PasswordConfirmValidator.java	2010-06-16 21:39:17 UTC (rev 13200)
@@ -31,6 +31,8 @@
 
 import org.jboss.seam.examples.booking.model.User;
 import org.jboss.seam.faces.validation.InputField;
+import org.jboss.seam.international.status.MessageFactory;
+import org.jboss.seam.international.status.builder.BundleKey;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
@@ -44,6 +46,9 @@
    private User currentUser;
 
    @Inject
+   private MessageFactory msg;
+
+   @Inject
    @InputField
    private String oldPassword;
 
@@ -59,12 +64,16 @@
    {
       if ((currentUser.getPassword() != null) && !currentUser.getPassword().equals(oldPassword))
       {
-         throw new ValidatorException(new FacesMessage("Your original password is incorrect."));
+         /*
+          * This is an ugly way to put i18n in FacesMessages:
+          * https://jira.jboss.org/browse/SEAMFACES-24
+          */
+         throw new ValidatorException(new FacesMessage(msg.info(new BundleKey("messages.properties", "account.passwordNotConfirmed")).build().getText()));
       }
 
       if ((newPassword != null) && !newPassword.equals(confirmNewPassword))
       {
-         throw new ValidatorException(new FacesMessage("New passwords do not match."));
+         throw new ValidatorException(new FacesMessage(msg.info(new BundleKey("messages.properties", "account.passwordsDoNotMatch")).build().getText()));
       }
    }
 

Modified: examples/trunk/booking-simplified/src/main/resources/messages.properties
===================================================================
--- examples/trunk/booking-simplified/src/main/resources/messages.properties	2010-06-16 21:32:58 UTC (rev 13199)
+++ examples/trunk/booking-simplified/src/main/resources/messages.properties	2010-06-16 21:39:17 UTC (rev 13200)
@@ -5,6 +5,7 @@
 booking.canceled=The booking at the {0} on {1,date} has been canceled.
 booking.doesNotExist=Our records indicate that the booking you selected has already been canceled.
 account.passwordChanged=Password successfully updated.
+account.passwordNotConfirmed=Your current password was not valid. Please try again.
 account.passwordsDoNotMatch=Passwords do not match. Please re-type the new password.
 account.usernameTaken=The username '{0}' is already taken. Please choose another username.
 registration.registered=You have been successfully registered as the user {0}!

Modified: examples/trunk/booking-simplified/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/booking-simplified/src/main/webapp/home.xhtml	2010-06-16 21:32:58 UTC (rev 13199)
+++ examples/trunk/booking-simplified/src/main/webapp/home.xhtml	2010-06-16 21:39:17 UTC (rev 13200)
@@ -59,11 +59,16 @@
                   <li>gavin/mexico</li>
                   <li>pete/edinburgh</li>
                   <li>shane/brisbane</li>
+                  <li>lincoln/charlotte</li>
                   <li>dan/laurel</li>
                </ul>
             </div>
          </fieldset>
       </h:form>
+      
+      <h:panelGroup rendered="#{identity.loggedIn}">
+      		You are logged in.
+      </h:panelGroup>
    </ui:define>
 
 </ui:composition>



More information about the seam-commits mailing list