Development
This commit is contained in:
parent
5b1f905ed0
commit
44261e5b5c
6 changed files with 87 additions and 33 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from pathlib import Path
|
||||
from flask import Blueprint, request, session, redirect, flash
|
||||
import os, bcrypt, secrets, smtplib
|
||||
import bcrypt, secrets, smtplib
|
||||
import time
|
||||
from email.message import EmailMessage
|
||||
import auth
|
||||
|
|
@ -15,14 +15,16 @@ CODE_TTL_SECS = 15 * 60
|
|||
|
||||
|
||||
def _send_verification_email(to_address, code):
|
||||
host = os.environ.get('SMTP_HOST', '')
|
||||
port = int(os.environ.get('SMTP_PORT', 587))
|
||||
user = os.environ.get('SMTP_USER', '')
|
||||
password = os.environ.get('SMTP_PASSWORD', '')
|
||||
from_addr = os.environ.get('SMTP_FROM', user)
|
||||
import settings as _s
|
||||
smtp = _s.get_smtp_config()
|
||||
host = smtp['host']
|
||||
port = smtp['port']
|
||||
user = smtp['user']
|
||||
password = smtp['password']
|
||||
from_addr = smtp['from'] or user
|
||||
|
||||
if not host:
|
||||
raise RuntimeError('SMTP_HOST is not configured.')
|
||||
raise RuntimeError('SMTP host is not configured.')
|
||||
|
||||
msg = EmailMessage()
|
||||
msg['Subject'] = f'{config_utils.WEB_APP_DISPLAY_NAME} - Email Verification'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue