Skip to content

Commit

Permalink
Properly use site name/title in email template
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Nov 9, 2020
1 parent ebe81b6 commit 7c1255e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 1 addition & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ services:
app:
build:
context: .
args:
http_proxy:
https_proxy:
no_proxy:
image: django_puzzlehunt # Name image for use in huey
restart: always
volumes:
Expand All @@ -33,6 +29,7 @@ services:
- ./docker/volumes/logs:/var/log/external
environment:
- DOMAIN
- SITE_TITLE
- DJANGO_SECRET_KEY
- DJANGO_ENABLE_DEBUG
- DJANGO_EMAIL_USER
Expand Down Expand Up @@ -73,9 +70,6 @@ services:
context: ./docker/
dockerfile: apacheDockerfile
args:
http_proxy:
https_proxy:
no_proxy:
DOMAIN: ${DOMAIN}
depends_on:
- app
Expand Down
2 changes: 1 addition & 1 deletion huntserver/migrations/0054_auto_20200318_2145.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setup_pages(apps, schema_editor):
try:
our_site = Site.objects.get(pk=1)
except:
our_site = Site.objects.create(domain=settings.DOMAIN, name=settings.DOMAIN)
our_site = Site.objects.create(domain=settings.DOMAIN, name=settings.SITE_TITLE)

source = get_template("contact_us.html").template.source.split("</readme> -->")[1]
fp = FlatPage.objects.create(url='/contact-us/', title='Contact Us', content=source)
Expand Down
7 changes: 6 additions & 1 deletion puzzlehunt_server/settings/env_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@

INTERNAL_IPS = ['127.0.0.1', 'localhost']
EMAIL_HOST = os.environ.get("DJANGO_EMAIL_HOST")
EMAIL_PORT = os.environ.get("DJANGO_EMAIL_PORT")
EMAIL_PORT = int(os.environ.get("DJANGO_EMAIL_PORT", default="587"))
EMAIL_HOST_USER = os.environ.get("DJANGO_EMAIL_USER")
EMAIL_HOST_PASSWORD = os.environ.get("DJANGO_EMAIL_PASSWORD")
EMAIL_FROM = os.environ.get("DJANGO_EMAIL_FROM")
DEFAULT_FROM_EMAIL = EMAIL_FROM
SERVER_EMAIL = EMAIL_FROM
DOMAIN = os.getenv("DOMAIN", default="default.com")
CHAT_ENABLED = os.getenv("PUZZLEHUNT_CHAT_ENABLED", default="True").lower() == "true"

if "SITE_TITLE" in os.environ:
SITE_TITLE = os.getenv("SITE_TITLE")

ALLOWED_HOSTS = ['*']
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
We have recieved a password reset request for the user: {{ user.get_username }}

If this is your account, and you have requested this password reset, you can
click the link below to initiate the password reset process for your PuzzlehuntCMU account:
click the link below to initiate the password reset process for your {{ site_name }} account:

{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}

Expand All @@ -13,5 +13,5 @@
If you did not request this password reset, just ignore this email.

Sincerely,
PuzzlehuntCMU Staff
{{ site_name }} Staff
{% endautoescape %}
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DB_PASSWORD=my_password
DB_USER=user
DJANGO_SECRET_KEY=mysecretkey
DOMAIN=your.domain-here.com
SITE_TITLE="Puzzlehunt CMU"
CONTACT_EMAIL=sample_email@example.com
PROJECT_NAME=puzzlehunt_site
# PUZZLEHUNT_CHAT_ENABLED=True
Expand Down

0 comments on commit 7c1255e

Please sign in to comment.