From 9b4d98e3d9d46b3de87f0abdb007f7573bea6780 Mon Sep 17 00:00:00 2001 From: deflax Date: Wed, 3 Apr 2024 18:21:53 +0300 Subject: [PATCH] remove expiration argument --- src/forest/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/forest/models.py b/src/forest/models.py index e163652..7613c57 100644 --- a/src/forest/models.py +++ b/src/forest/models.py @@ -1,5 +1,6 @@ from werkzeug.security import generate_password_hash, check_password_hash from itsdangerous.url_safe import URLSafeTimedSerializer as Serializer +from itsdangerous.exc import BadSignature, SignatureExpired from flask import current_app, request, url_for from flask_sqlalchemy import SQLAlchemy @@ -123,8 +124,8 @@ class User(db.Model, UserMixin): def verify_totp(self, token): return onetimepass.valid_totp(token, self.otp_secret) - def generate_confirmation_token(self, expiration=86400): - s = Serializer(current_app.config['SECRET_KEY'], expiration) + def generate_confirmation_token(self): + s = Serializer(current_app.config['SECRET_KEY']) return s.dumps({'confirm': self.id}) def confirm(self, token): @@ -140,8 +141,8 @@ class User(db.Model, UserMixin): db.session.commit() return True - def generate_reset_token(self, expiration=86400): - s = Serializer(current_app.config['SECRET_KEY'], expiration) + def generate_reset_token(self): + s = Serializer(current_app.config['SECRET_KEY']) return s.dumps({'reset': self.id}) def reset_password(self, token, new_password):