def send_recovery_email(self): from trex.support import mail from app import app mail.send( to = self.user.email, subject = 'Password reset email for %s' % app.settings.get('app', 'name'), text_body = "Hi,\n\nYou can reset your password by clicking on this link:\n %(direct_url)s\n\nOr, you can use the code %(code)s at this link: %(url)s\n\n--\n%(app_name)s" % dict( code = self.code, direct_url = url_for('trex.auth.recover_password', _external=True, code=self.code), url = url_for('trex.auth.lost_password_sent', _external=True), app_name = app.settings.get('app', 'name'), ) )
def notify_password_reset(self, new_password): from trex.support import mail from app import app mail.send( to = self.email, subject = 'Your password on %s was reset' % app.settings.get('app', 'name'), text_body = "Hi,\n\nYou have a new password on %(app_name)s. Your login details are:\n\nEmail: %(email)s\nPassword: %(password)s\n\nYou can log in at: %(app_url)s\n\n--\n%(app_name)s" % dict( app_name = app.settings.get('app', 'name'), app_url = url_for('index.index', _external=True), email = self.email, password = new_password, ) ) return "Password emailed to %s" % self.email