def send_email_2fa_code(self, code: str) -> Response: subject = response_quote("email2fa_code_mail_subject") text = response_quote("email2fa_code_mail_text") html = f'<html>' \ f'{response_quote("email2fa_code_mail_text").format(EmailSecondFA.token_expiration_delta().seconds // 60)} ' \ f'<h4>{code}</h4></html>' return MailGun.send_email_message([self.email], subject, text, html)
def confirm(self) -> Response: link = request.url_root[0:-1] + url_for( "confirmation", confirmation_id=self.most_recent_confirmation.id) subject = f"{response_quote('user_registration_confirmation_subject')}" text = f"{response_quote('user_registration_confirmation_text')} {link}" html = f'<html>{response_quote("user_registration_confirmation_text")}: <a href="{link}">{link}</a></html>' return MailGun.send_email_message([self.email], subject, text, html)
def password_reset_request(self, code: str) -> Response: subject = f"{response_quote('user_password_restore_subject').format(self.email)}" text = f"{response_quote('user_password_restore_text').format(code)}" html = f'<html>{response_quote("user_password_restore_text").format(code)}</html>' return MailGun.send_email_message([self.email], subject, text, html)