doortts doortts 2017-04-24
signup: Fix validation code expiring check bug
@054578405fda135569b3fa2905ea2dad15f8ee28
app/models/UserVerification.java
--- app/models/UserVerification.java
+++ app/models/UserVerification.java
@@ -33,7 +33,7 @@
 
     public Long timestamp;
 
-    public static UserVerification newVerification(User user) {
+    public static synchronized UserVerification newVerification(User user) {
         UserVerification v = new UserVerification();
         v.user = user;
         v.loginId = user.loginId;
@@ -63,10 +63,11 @@
     }
 
     public boolean isValidDate(){
-        if( this.timestamp + 60*60*24  > new Date().getTime()) {
+        if( this.timestamp + 60*60*24*1000  > new Date().getTime()) {
             return true;
         } else {
             this.delete();
+            play.Logger.error("Email validation is expired: " + this.loginId + ":" + this.verificationCode);
             return false;
         }
     }
@@ -74,4 +75,15 @@
     public void invalidate(){
         this.delete();
     }
+
+    @Override
+    public String toString() {
+        return "UserVerification{" +
+                "id=" + id +
+                ", user=" + user +
+                ", loginId='" + loginId + '\'' +
+                ", verificationCode='" + verificationCode + '\'' +
+                ", timestamp=" + timestamp +
+                '}';
+    }
 }
Add a comment
List