incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r819481 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala
Date Mon, 28 Sep 2009 09:20:21 GMT
Author: vdichev
Date: Mon Sep 28 09:20:19 2009
New Revision: 819481

URL: http://svn.apache.org/viewvc?rev=819481&view=rev
Log:
ESME-85 Display error messages for invalid sign-up details

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala?rev=819481&r1=819480&r2=819481&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/UserAuth.scala Mon Sep
28 09:20:19 2009
@@ -151,18 +151,28 @@
            "pwd2" -> SHtml.password(pwd2, s => pwd2 = s.trim))
     ) openOr NodeSeq.Empty
 
-    def validate: List[FieldError] =
-    (if (MappedEmail.validEmailAddr_?(email)) Nil else
-     List(FieldError(new FieldIdentifier {
-          override def uniqueFieldId: Box[String] = Full("email")
-        },Text(S.?("Bad email address"))))) :::
-    (if (pwd1 != pwd2) List(FieldError(new FieldIdentifier {
-          override def uniqueFieldId: Box[String] = Full("pwd1")
-        },Text(S.?("Passwords do not match"))))
-    else if (pwd1.length < 6) List(FieldError(new FieldIdentifier {
-          override def uniqueFieldId: Box[String] = Full("pwd1")
-        },Text(S.?("Passwords must be 6 characters or longer"))))
-    else Nil)
+    def validate: List[FieldError] = (
+    if (MappedEmail.validEmailAddr_?(email)) Nil else {
+      val msg = S.?("Bad email address")
+      S.error(msg)
+      List(FieldError(new FieldIdentifier {
+        override def uniqueFieldId: Box[String] = Full("email")
+      }, Text(msg)))
+    }
+    ) ::: (
+    if (pwd1 != pwd2) {
+      val msg = S.?("Passwords do not match")
+      S.error(msg)
+      List(FieldError(new FieldIdentifier {
+        override def uniqueFieldId: Box[String] = Full("pwd1")
+      }, Text(msg)))
+    } else if (pwd1.length < 6) {
+      val msg = S.?("Passwords must be 6 characters or longer")
+      S.error(msg)
+      List(FieldError(new FieldIdentifier {
+        override def uniqueFieldId: Box[String] = Full("pwd1")
+      }, Text(msg)))
+    } else Nil)
 
     def save(user: User): Unit = {
       val salt = randomString(10)



Mime
View raw message