Skip to content

Commit

Permalink
mail auth update
Browse files Browse the repository at this point in the history
  • Loading branch information
hamin committed Nov 28, 2024
1 parent 4363097 commit aa9b9f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Config(object):
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
MAIL_USE_SSL = os.environ.get('MAIL_USE_SSL') is not None
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_USER = os.environ.get('MAIL_USER')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
# print("MAIL PASSWORD", MAIL_PASSWORD)
INSTANCE = os.environ.get('INSTANCE') or "PRODUCTION"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ services:
- INSTANCE=(DEV)
- ADMINS=jboucas@gmail.com
- MAIL_USERNAME=jboucas@gmail.com
- MAIL_USER=${MAIL_USER}
# - MAIL_PORT=465 # comment if using the dev server
# - MAIL_USE_TLS=1 # comment if using the dev server
labels:
Expand Down
7 changes: 6 additions & 1 deletion myapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@
if not app.debug:
if app.config['MAIL_SERVER']:
auth = None
if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']:
# Commented as authentication method changed
# if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']:
# auth = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD'])
if app.config['MAIL_USER'] and app.config['MAIL_PASSWORD']:
auth = (app.config['MAIL_USER'], app.config['MAIL_PASSWORD'])
elif app.config['MAIL_USERNAME'] and app.config['MAIL_PASSWORD']:
auth = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD'])
secure = None
if app.config['MAIL_USE_TLS']:
Expand Down

0 comments on commit aa9b9f9

Please sign in to comment.