Skip to content

Commit

Permalink
fix user email reset
Browse files Browse the repository at this point in the history
  • Loading branch information
sn6uv committed Oct 17, 2016
1 parent 6711a35 commit c4d349b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion mathics/settings.py
Expand Up @@ -58,7 +58,13 @@

REQUIRE_LOGIN = False

SERVER_EMAIL = 'mathics@localhost'
# if REQUIRE_LOGIN is True be sure to set up an email sender:
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'mathics'
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 587
EMAIL_USE_TLS = True


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
Expand Down
7 changes: 3 additions & 4 deletions mathics/web/views.py
Expand Up @@ -17,6 +17,8 @@
from django.contrib import auth
from django.contrib.auth.models import User

from django.core.mail import send_mail

from mathics.core.definitions import Definitions
from mathics.core.evaluation import Evaluation, Message, Result, Output

Expand Down Expand Up @@ -187,10 +189,7 @@ def n_part(slen):


def email_user(user, subject, text):
if settings.DEBUG_MAIL:
print('\n'.join(['-' * 70, 'E-Mail to %s:\n%s\n%s' % (user.email, subject, text), '-' * 70]))
else:
user.email_user(subject, text)
send_mail(subject, text, 'noreply@mathics.net', [user.username], fail_silently=False)


def login(request):
Expand Down

0 comments on commit c4d349b

Please sign in to comment.