fix reset password expired

This commit is contained in:
Son NK 2019-07-08 14:21:13 +02:00 committed by Son NK
parent 43536734a0
commit 4227c3036d
2 changed files with 3 additions and 3 deletions

View File

@ -144,8 +144,9 @@ def send_reset_password_email(user):
"""
generate a new ResetPasswordCode and send it over email to user
"""
# the activation code is valid for 1h
reset_password_code = ResetPasswordCode.create(
user_id=user.id, code=random_string(60)
user_id=user.id, code=random_string(60), expired=arrow.now().shift(hours=1)
)
db.session.commit()

View File

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