diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index d6cbea8bc5..4494006dc2 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -108,7 +108,7 @@ class User(Document): ) if self.name not in ('Administrator', 'Guest') and not self.user_image: frappe.enqueue('frappe.core.doctype.user.user.update_gravatar', name=self.name, now=now) - + # Set user selected timezone if self.time_zone: frappe.defaults.set_default("time_zone", self.time_zone, self.name) @@ -1003,9 +1003,14 @@ def send_token_via_email(tmp_id,token=None): hotp = pyotp.HOTP(otpsecret) frappe.sendmail( - recipients=user_email, sender=None, subject='Verification Code', - message='
Your verification code is {0}
'.format(hotp.at(int(count))), - delayed=False, retry=3) + recipients=user_email, + sender=None, + subject="Verification Code", + template="verification_code", + args=dict(code=hotp.at(int(count))), + delayed=False, + retry=3 + ) return True diff --git a/frappe/templates/emails/verification_code.html b/frappe/templates/emails/verification_code.html new file mode 100644 index 0000000000..1562397e0b --- /dev/null +++ b/frappe/templates/emails/verification_code.html @@ -0,0 +1 @@ +{{ _("Your verification code is {0}").format(frappe.bold(code)) }}
\ No newline at end of file