mirror of
https://github.com/TrentSPalmer/flask_photo_scaling_app.git
synced 2025-02-18 13:40:55 -08:00
fix style app/models.py
This commit is contained in:
parent
86d482691b
commit
0a6c6a2afd
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user