fix style app/models.py

This commit is contained in:
Trent Palmer 2025-02-09 16:50:39 -08:00
parent 86d482691b
commit 0a6c6a2afd

View File

@ -64,12 +64,20 @@ class Contributor(UserMixin, db.Model):
return '<Contributor {}>'.format(self.name)
def get_reset_password_token(self, expires_in=1800):
return jwt.encode({'reset_password': self.id, 'exp': time() + expires_in}, current_app.config['SECRET_KEY'], algorithm='HS256').decode('utf-8')
return jwt.encode(
{'reset_password': self.id, 'exp': time() + expires_in},
current_app.config['SECRET_KEY'],
algorithm='HS256',
).decode('utf-8')
@staticmethod
def verify_reset_password_token(token):
try:
id = jwt.decode(token, current_app.config['SECRET_KEY'], algorithms=['HS256'])['reset_password']
id = jwt.decode(
token,
current_app.config['SECRET_KEY'],
algorithms=['HS256'],
)['reset_password']
except BaseException as error:
print('An exception occurred: {}'.format(error))
return Contributor.query.get(id)