Skip to content

Commit

Permalink
Add Email & Password Reset Support
Browse files Browse the repository at this point in the history
  • Loading branch information
aswinshenoy committed Mar 7, 2019
1 parent c2bc9c4 commit 24368a1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
6 changes: 6 additions & 0 deletions framework/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
AWS_DEFAULT_ACL = None
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
EMAIL_PORT = 587
EMAIL_USE_TLS = True

try:
import django_heroku
Expand Down
2 changes: 1 addition & 1 deletion framework/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
path('', include('pages.urls')),
path(
'admin/password_reset/',
auth_views.PasswordResetView.as_view(),
auth_views.PasswordResetView.as_view( html_email_template_name='registration/password_reset_email.html'),
name='admin_password_reset',
),
path(
Expand Down
25 changes: 25 additions & 0 deletions templates/registration/password_reset_email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% load i18n %}
{% load staticfiles %}
<!-- this ensures Gmail doesn't trim the email -->
<div style="background: #333; padding: 3rem">
<img src="{% static 'pages/images/logos/logo_light.png' %}" style="float: right">
<h1 style="color: white">amFOSS CMS</h1>
<!-- this ensures Gmail doesn't trim the email -->
<span style="background: white; padding: 1rem; display: block;">
Nama Shivayah @{{user.get_username}}, <br>

You're receiving this email because you requested a password reset for your amFOSS CMS account. <br>
Please go to the following page and choose a new password:<br>
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
<br>
<br>
Cheers,<br>
Web Team,<br>
FOSS@Amrita
</span>
<!-- this ensures Gmail doesn't trim the email -->
</div>
<!-- this ensures Gmail doesn't trim the email -->
<span style="opacity: 0"> {{ datetime.now }} </span>

0 comments on commit 24368a1

Please sign in to comment.