def run(self): """ Implements the class contract. """ user = UserEntityDAO.select_by_id(self.user_id) reset_code = "%s%s%s%s%s%s" % (random.randint(0, 9), random.randint(0, 9), random.randint(0, 9), random.randint(0, 9), random.randint(0, 9), random.randint(0, 9)) user.reset_password_code = reset_code #send the email EmailService.send_password_reset(user)
import os from trex import system system.initialize(os.path.abspath(os.path.join(os.path.dirname(__file__), ".env"))) from trex.commands.test_command import TestCommand from trex.data.daos.abstract_dao import AbstractDAO from trex.data.entities.abstract_entity import AbstractEntity from trex.services.business_services.email_service import EmailService from trex.utils.queue_util import QueueUtil EmailService.send_password_reset(None)