add email templates
This commit is contained in:
parent
bb96dc00a6
commit
f36db24bad
|
@ -12,18 +12,27 @@ MAILGUN_FROM = "postmaster <postmaster@%s>" % (MAILGUN_DOMAIN)
|
|||
|
||||
AUTH_URL = "%s/email_authorize" % (BACKEND_URL)
|
||||
|
||||
email_templates = {"confirm_email" : "", "auth_email" : "", "reset_password_email" : ""}
|
||||
|
||||
def load_email_templates():
|
||||
for name in email_templates:
|
||||
filename = "templates/%s.tmpl" % name
|
||||
with open(filename) as f:
|
||||
email_templates[name] = f.read()
|
||||
print("all email templates loaded")
|
||||
|
||||
async def send_confirm_email(user):
|
||||
text = "<html><body>To confirm registration follow the <a href='%s'>link</link></body></html>"
|
||||
text = email_templates["confirm_email"]
|
||||
token = await EmailAuthenticate.get_email_token(user)
|
||||
await send_email(user, AUTH_URL, text, token)
|
||||
|
||||
async def send_auth_email(user):
|
||||
text = "<html><body>To enter the site follow the <a href='%s'>link</link></body></html>"
|
||||
text = email_templates["auth_email"]
|
||||
token = await EmailAuthenticate.get_email_token(user)
|
||||
await send_email(user, AUTH_URL, text, token)
|
||||
|
||||
async def send_reset_password_email(user):
|
||||
text = "<html><body>To reset password follow the <a href='%s'>link</link></body></html>"
|
||||
text = email_templates["reset_password_email"]
|
||||
token = await ResetPassword.get_reset_token(user)
|
||||
await send_email(user, RESET_PWD_URL, text, token)
|
||||
|
||||
|
|
1
templates/auth_email.tmpl
Normal file
1
templates/auth_email.tmpl
Normal file
|
@ -0,0 +1 @@
|
|||
<html><body>To enter the site follow the <a href='%s'>link</link></body></html>
|
1
templates/confirm_email.tmpl
Normal file
1
templates/confirm_email.tmpl
Normal file
|
@ -0,0 +1 @@
|
|||
<html><body>To confirm registration follow the <a href='%s'>link</link></body></html>
|
1
templates/reset_password_email.tmpl
Normal file
1
templates/reset_password_email.tmpl
Normal file
|
@ -0,0 +1 @@
|
|||
<html><body>To reset password follow the <a href='%s'>link</link></body></html>
|
Loading…
Reference in New Issue
Block a user