From 2589fee8066e8b54351a00946d4cc8aa77059973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodor=20M=C3=A1t=C3=A9?= <bodor.mate@kszk.bme.hu> Date: Fri, 18 Jan 2019 15:56:29 +0100 Subject: [PATCH] First login send email with gmail test account --- src/account/auth_pipeline.py | 4 ++-- src/account/models.py | 1 - src/kszkepzes/settings/base.py | 7 +++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/account/auth_pipeline.py b/src/account/auth_pipeline.py index 2c6c425..3735b3a 100644 --- a/src/account/auth_pipeline.py +++ b/src/account/auth_pipeline.py @@ -1,5 +1,4 @@ from django.core import exceptions -from django.http import HttpResponseServerError from django.core.mail import send_mail from . import models @@ -11,4 +10,5 @@ def create_profile(backend, user, response, *args, **kwargs): user.profile except exceptions.ObjectDoesNotExist: models.Profile.objects.create(user=user) - send_mail('TESZT', 'Attiss meleg!4!!', 'noreply@keszkepzes.sch.bme.hu', user.email) + if user.email is not None: + send_mail('TESZT', 'Attiss meleg!4!!', 'noreply@devteam.sch.bme.hu', [user.email, ]) diff --git a/src/account/models.py b/src/account/models.py index b8188f3..d53c338 100644 --- a/src/account/models.py +++ b/src/account/models.py @@ -1,7 +1,6 @@ from django.db import models from django.contrib.auth.models import User from solo.models import SingletonModel -from common.middleware import CurrentUserMiddleware class GroupChoice(models.Model): diff --git a/src/kszkepzes/settings/base.py b/src/kszkepzes/settings/base.py index 305d41c..a00562b 100644 --- a/src/kszkepzes/settings/base.py +++ b/src/kszkepzes/settings/base.py @@ -159,6 +159,9 @@ STATIC_URL = '/django-static/' MEDIA_ROOT = os.getenv('MEDIA_ROOT', '/tmp') MEDIA_URL = '/media/' -EMAIL_HOST = 'mail.sch.bme.hu' -EMAIL_PORT = 587 +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_HOST = 'smtp.gmail.com' EMAIL_USE_TLS = True +EMAIL_PORT = 587 +EMAIL_HOST_USER = 'bmate711kamu@gmail.com' +EMAIL_HOST_PASSWORD = '1IronxDog' -- GitLab