fix activation code

This commit is contained in:
Son NK 2019-07-08 12:10:14 +02:00 committed by Son NK
parent 80d9a6a400
commit 17a4679b90
2 changed files with 5 additions and 3 deletions

View File

@ -61,7 +61,10 @@ def register():
def send_activation_email(user):
activation = ActivationCode.create(user_id=user.id, code=random_string(30))
# the activation code is valid for 1h
activation = ActivationCode.create(
user_id=user.id, code=random_string(30), expired=arrow.now().shift(hours=1)
)
db.session.commit()
# Send user activation email

View File

@ -196,8 +196,7 @@ class ActivationCode(db.Model, ModelMixin):
user = db.relationship(User)
# the activation code is valid for 1h
expired = db.Column(ArrowType, default=arrow.now().shift(hours=1))
expired = db.Column(ArrowType)
class ResetPasswordCode(db.Model, ModelMixin):