Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env_sample
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ SELENIUM_HOSTNAME=selenium
#EMAIL_HOST_PASSWORD=pass
#EMAIL_PORT=587
#EMAIL_USE_TLS=True
#DEFAULT_FROM_EMAIL="Codabench <noreply@example.com>"
#SERVER_EMAIL=noreply@example.com

# Contact Email
Expand Down
2 changes: 1 addition & 1 deletion src/apps/forums/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def send_mail(context=None, from_email=None, html_file=None, text_file=None, sub
:param subject: Email's subject.
:param to_email: Recipient's email.
"""
from_email = from_email if from_email else settings.DEFAULT_FROM_EMAIL
from_email = from_email if from_email else settings.SERVER_EMAIL

context["site"] = Site.objects.get_current()

Expand Down
2 changes: 1 addition & 1 deletion src/apps/profiles/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def send_mail(context=None, from_email=None, html_file=None, text_file=None, sub
:param subject: Email's subject.
:param to_email: Recipient's email.
"""
from_email = from_email if from_email else settings.DEFAULT_FROM_EMAIL
from_email = from_email if from_email else settings.SERVER_EMAIL

context["site"] = Site.objects.get_current()

Expand Down
2 changes: 0 additions & 2 deletions src/apps/profiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ class CustomPasswordResetView(auth_views.PasswordResetView):
We have to use app:view_name syntax in templates like " {% url 'accounts:password_reset_confirm'%} "
Therefore we need to tell this view to find the right success_url with that syntax or django won't be
able to find the view.
3. from_email: We want to use SERVER_EMAIL already set in the .env
# The other commented sections are the defaults for other attributes in auth_views.PasswordResetView.
They are in here in case someone wants to customize in the future. All attributes show up in the order
shown in the docs.
Expand All @@ -358,7 +357,6 @@ class CustomPasswordResetView(auth_views.PasswordResetView):
# subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied.
# token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator.
success_url = django.urls.reverse_lazy("accounts:password_reset_done")
from_email = settings.SERVER_EMAIL


class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView):
Expand Down
1 change: 0 additions & 1 deletion src/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ def setup_celery_logging(**kwargs):
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
EMAIL_PORT = os.environ.get('EMAIL_PORT', 587)
EMAIL_USE_TLS = os.environ.get('EMAIL_USE_TLS', True)
DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL', 'Codabench <noreply@codabench.org>')
SERVER_EMAIL = os.environ.get('SERVER_EMAIL', 'noreply@codabench.org')

CONTACT_EMAIL = os.environ.get('CONTACT_EMAIL', 'info@codabench.org')
Expand Down
4 changes: 2 additions & 2 deletions src/utils/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def codalab_send_mail(context_data, to_email, html_file, text_file, subject, from_email=None):
from_email = from_email if from_email else settings.DEFAULT_FROM_EMAIL
from_email = from_email if from_email else settings.SERVER_EMAIL

context_data["site"] = Site.objects.get_current()

Expand Down Expand Up @@ -40,7 +40,7 @@ def sanitize(content):


def codalab_send_markdown_email(subject, markdown_content, recipient_list, from_email=None):
from_email = from_email if from_email else settings.DEFAULT_FROM_EMAIL
from_email = from_email if from_email else settings.SERVER_EMAIL
html_message = markdown.markdown(markdown_content)
# message = sanitize(markdown_content)
# html_message = sanitize(markdown.markdown(message))
Expand Down