code: def change_password(self, user, new_password):
          
          from boiler.user.models import UpdateSchema
          from flask_login import logout_user
  
          schema = UpdateSchema()
          user.password = new_password
          user.password_link=None
          user.password_link_expires=None
          valid = schema.validate(user)
  
          if not valid:
              return valid
  
          db.session.add(user)
          db.session.commit()
  
          # logout if a web request
          if has_request_context():
              logout_user()
  
          events.password_changed_event.send(user)
          return user
docs: Change user password and logout