forked from rDrama/rDrama
add a 2nd email account for WPD
parent
2ec5531080
commit
a75d481f60
|
@ -16,6 +16,7 @@ import time
|
||||||
from sys import stdout, argv
|
from sys import stdout, argv
|
||||||
import faulthandler
|
import faulthandler
|
||||||
import json
|
import json
|
||||||
|
import random
|
||||||
|
|
||||||
app = Flask(__name__, template_folder='templates')
|
app = Flask(__name__, template_folder='templates')
|
||||||
app.url_map.strict_slashes = False
|
app.url_map.strict_slashes = False
|
||||||
|
@ -43,8 +44,13 @@ app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL", "redis://localhost")
|
||||||
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
|
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
|
||||||
app.config['MAIL_PORT'] = 587
|
app.config['MAIL_PORT'] = 587
|
||||||
app.config['MAIL_USE_TLS'] = True
|
app.config['MAIL_USE_TLS'] = True
|
||||||
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
|
|
||||||
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
if environ.get("MAIL_USERNAME2") and random.random() < 0.5:
|
||||||
|
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME2", "").strip()
|
||||||
|
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD2", "").strip()
|
||||||
|
else:
|
||||||
|
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
|
||||||
|
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
||||||
|
|
||||||
app.config['SETTINGS'] = {}
|
app.config['SETTINGS'] = {}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from flask_mail import Message
|
||||||
|
|
||||||
def send_mail(to_address, subject, html):
|
def send_mail(to_address, subject, html):
|
||||||
|
|
||||||
msg = Message(html=html, subject=subject, sender=f"{SITE_NAME}@{SITE}", recipients=[to_address])
|
msg = Message(html=html, subject=subject, sender=app.config['MAIL_USERNAME'], recipients=[to_address])
|
||||||
mail.send(msg)
|
mail.send(msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<p class="text-small text-muted">Change the email address used to sign in to your account.</p>
|
<p class="text-small text-muted">Change the email address used to sign in to your account.</p>
|
||||||
<div class="settings-section rounded">
|
<div class="settings-section rounded">
|
||||||
<form action="/settings/security" method="post">
|
<form action="/settings/security" method="post">
|
||||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="d-lg-flex">
|
<div class="d-lg-flex">
|
||||||
|
|
Loading…
Reference in New Issue