Open NightDev19 opened 1 year ago
I got it working by using the 'URLSafeTimedSerializer' module instead.
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
def get_reset_token(self, expires_sec=1800):
s = Serializer(app.config['SECRET_KEY'], expires_sec)
return s.dumps({'user_id': self.id}).decode('utf-8')
@staticmethod
def verify_reset_token(token):
s = Serializer(app.config['SECRET_KEY'])
try:
user_id = s.loads(token)['user_id']
except:
return None
return User.query.get(user_id)
from itsdangerous import URLSafeTimedSerializer as Serializer
def get_reset_token(self):
s = Serializer(app.config['SECRET_KEY'])
return s.dumps({'user_id': self.id})
@staticmethod
def verify_reset_token(token):
s = Serializer(app.config['SECRET_KEY'])
try:
user_id = s.loads(token, max_age=1800)['user_id']
except:
return None
return User.query.get(user_id)
go to you gmail account settings > security > 2 step verification>app >create new
you can name it whatever you want google will generate a password for your app you won't need to use your actual google password
copy the password and paste it in app[MAIL_PASS] and you'll be good to go. If your 2 step verification is off you'll have to turn it on hope this helps
i think that return s.dumps({'user_id': self.id}).decode('utf-8') cant rea for newer version of python