File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ class User(Base):
6565
6666 # Relationships
6767 password_resets = relationship ("PasswordReset" , backref = "user" )
68+ email_verifications = relationship ("EmailVerification" , backref = "user" )
6869
6970 avatar = relationship ("Image" ,
7071 lazy = "joined" ,
@@ -415,3 +416,18 @@ def __init__(self, user_id):
415416 @staticmethod
416417 def generate_callback_id ():
417418 return '' .join (choice ('0123456789ABCDEF' ) for i in range (16 ))
419+
420+
421+ class EmailVerification (Base ):
422+ id = Column (Integer , primary_key = True , index = True , autoincrement = True )
423+ user_id = Column (Integer , ForeignKey ("user.id" ))
424+ callback_id = Column (String )
425+ created_at = Column (DateTime , default = datetime .datetime .utcnow , nullable = False )
426+
427+ def __init__ (self , user_id ):
428+ self .callback_id = self .generate_callback_id ()
429+ self .user_id = user_id
430+
431+ @staticmethod
432+ def generate_callback_id ():
433+ return '' .join (choice ('0123456789ABCDEF' ) for i in range (16 ))
You can’t perform that action at this time.
0 commit comments