diff --git a/src/account/auth_pipeline.py b/src/account/auth_pipeline.py index 4a9cfa1025deb8617695487158caaadd82b1114c..16eb573a1b7685e0b52a86eaa46470a9ff604ce7 100644 --- a/src/account/auth_pipeline.py +++ b/src/account/auth_pipeline.py @@ -1,15 +1,14 @@ from django.core import exceptions -from django.core.mail import send_mail +from common.email import registration_email from . import models def create_profile(backend, user, response, *args, **kwargs): if backend.name == 'authsch': + if user.email is not None: + registration_email(user.email) try: user.profile except exceptions.ObjectDoesNotExist: models.Profile.objects.create(user=user) - if user.email is not None: - send_mail('TESZT', 'Udvozlunk a kszkepzesen, ne felejtsd el kitolteni a profilod.', - 'noreply@devteam.sch.bme.hu', [user.email, ]) diff --git a/src/common/email.py b/src/common/email.py new file mode 100644 index 0000000000000000000000000000000000000000..6e455ad7a3131cc3cd9b4f24419aafa024960575 --- /dev/null +++ b/src/common/email.py @@ -0,0 +1,6 @@ +from django.core.mail import send_mail + + +def registration_email(email): + send_mail('TESZT', 'Udvozlunk a kszkepzesen, ne felejtsd el kitolteni a profilod.', + 'noreply@devteam.sch.bme.hu', [email, ]) \ No newline at end of file diff --git a/src/kszkepzes/settings/base.py b/src/kszkepzes/settings/base.py index a00562b4480516e78a8257ca7654cecf68016a82..b831a0ec690d3c2ff85248e79972ab90f1b260f2 100644 --- a/src/kszkepzes/settings/base.py +++ b/src/kszkepzes/settings/base.py @@ -38,7 +38,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'django_extensions', - 'import_export', + 'import_export', 'rest_framework', 'social_django', 'solo', @@ -158,10 +158,3 @@ STATIC_URL = '/django-static/' MEDIA_ROOT = os.getenv('MEDIA_ROOT', '/tmp') MEDIA_URL = '/media/' - -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' diff --git a/src/kszkepzes/settings/local.py b/src/kszkepzes/settings/local.py index 9d29321b1c2c5631269cf0b3f4a76b1e09c31873..2cb6909eb82d4a0c961584326c805653a9a322c0 100644 --- a/src/kszkepzes/settings/local.py +++ b/src/kszkepzes/settings/local.py @@ -1,3 +1,9 @@ from .base import * SESSION_COOKIE_SECURE=False +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' diff --git a/src/kszkepzes/settings/production.py b/src/kszkepzes/settings/production.py index ebf105027c4fcc9bd936482fd349dc1d7f526323..8fa02bbbee624b5c15dfee9abea77167ae82cd87 100644 --- a/src/kszkepzes/settings/production.py +++ b/src/kszkepzes/settings/production.py @@ -26,3 +26,9 @@ REST_FRAMEWORK = { } STATIC_ROOT = os.path.join(BASE_DIR, 'static_collected') + + +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_HOST = 'mail.sch.bme.hu' +EMAIL_USE_TLS = True +EMAIL_PORT = 587