]> git.mxchange.org Git - juser-login-core.git/commitdiff
Email changing is only possible with a cryptographic hash ... opps
authorRoland Haeder <roland@mxchange.org>
Sat, 12 Mar 2016 17:38:23 +0000 (18:38 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 12 Mar 2016 17:38:23 +0000 (18:38 +0100)
src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java
src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java

index a672c2b2f2ee428c6451cb4e88c158b2b7853dd0..c6fd7de1370341032f364fa58013df0d4c16e20b 100644 (file)
@@ -113,6 +113,20 @@ public interface ChangeableEmailAddress extends Serializable {
         */
        void setEmailChangeStatus (final EmailChangeStatus emailChangeStatus);
 
+       /**
+        * Getter for email change hash
+        * <p>
+        * @return Email change hash
+        */
+       String getEmailChangeHash ();
+
+       /**
+        * Getter for email change hash
+        * <p>
+        * @param emailChangeHash Email change hash
+        */
+       void setEmailChangeHash (final String emailChangeHash);
+
        @Override
        boolean equals (final Object object);
 
index e3c4225cda1f19b6ae4abdc76f6dce0910e6ee5b..153163056b1c11e8dff886133e926b8415dd722f 100644 (file)
@@ -27,6 +27,7 @@ import javax.persistence.Enumerated;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
@@ -44,7 +45,12 @@ import org.mxchange.jusercore.model.user.User;
  * @author Roland Haeder<roland@mxchange.org>
  */
 @Entity (name = "email_changes")
-@Table (name = "email_changes")
+@Table (
+               name = "email_changes",
+               indexes = {
+                       @Index (name = "hash", columnList = "email_change_hash", unique = true)
+               }
+)
 @NamedQueries (
                @NamedQuery (name = "SearchEmailChangeByEmail", query = "SELECT e FROM email_changes AS e WHERE LOWER(e.emailAddress) LIKE LOWER(:email)")
 )
@@ -78,6 +84,13 @@ public class EmailAddressChange implements ChangeableEmailAddress {
        @Column (name = "email_change_done", nullable = false, updatable = false)
        private Calendar emailChangeDone;
 
+       /**
+        * Email change hash the user has to click
+        */
+       @Basic (optional = false)
+       @Column (name = "email_change_hash", unique = true)
+       private String emailChangeHash;
+
        /**
         * Email change id
         */
@@ -183,6 +196,16 @@ public class EmailAddressChange implements ChangeableEmailAddress {
                this.emailChangeDone = emailChangeDone;
        }
 
+       @Override
+       public String getEmailChangeHash () {
+               return this.emailChangeHash;
+       }
+
+       @Override
+       public void setEmailChangeHash (final String emailChangeHash) {
+               this.emailChangeHash = emailChangeHash;
+       }
+
        @Override
        public Long getEmailChangeId () {
                return this.emailChangeId;