Ejemplo n.º 1
0
 def post(self):
     request_dict = request.get_json(force=True)['data']['attributes']
     email = request_dict['email']
     user = Users.query.filter_by(email=email).first()
     if user is not None:
         token = create_token(user)
         msg = Message("Here's your Password Reset Link :)",
                       recipients=[email])
         msg.html = PASSWORD_RESET_EMAIL.format(token=token)
         mail.send(msg)
         return {"message": "Password reset mail sent successfully"}, 201
     else:
         return {"error": "We could not find this email address :("}, 404
Ejemplo n.º 2
0
 def post(self):
     request_dict = request.get_json(force=True)['data']['attributes']
     email = request_dict['email']
     user = Users.query.filter_by(email=email).first()
     if user is not None:
         token = create_token(user)
         msg = Message("Here's your Password Reset Link :)",
                       recipients=[email])
         msg.html = PASSWORD_RESET_EMAIL.format(token=token)
         mail.send(msg)
         return {"error": "Password reset mail sent successfully"}, 201
     else:
         return {"error": "We could not find this email address :("}, 404