diff --git a/OACPL/settings.base.py b/OACPL/settings.base.py index 2a45355..ce75c17 100644 --- a/OACPL/settings.base.py +++ b/OACPL/settings.base.py @@ -27,6 +27,12 @@ DEBUG = False ALLOWED_HOSTS = ['*'] +# https://accounts.google.com/DisplayUnlockCaptcha +EMAIL_USE_TLS = True +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_HOST_USER = 'zaktimson@gmail.com' +EMAIL_HOST_PASSWORD = '' +EMAIL_PORT = 587 # Application definition diff --git a/main/views.py b/main/views.py index 17c511d..0131b30 100644 --- a/main/views.py +++ b/main/views.py @@ -1,9 +1,11 @@ from django.shortcuts import render, redirect from django.contrib import auth from django.contrib.auth.models import User +from django.core import mail from charter_members.models import Attorney from newsletters.models import Subscriber +from OACPL import settings def index(request): @@ -25,7 +27,8 @@ def login(request): email=request.POST.get('email'), password=request.POST.get('password')) user.save() - # TODO: Send confirmation email + if settings.EMAIL_HOST: + mail.send_mail('OACPL Registration', 'You have successfully registered to the Ontario Asscocaition of Child Protection Lawyers!', settings.EMAIL_HOST_USER, [request.POST.get('email')]) if request.POST.get('newsletter'): Subscriber.objects.create(email=request.POST.get('email')) # TODO: If Case law access was requested, send an email out to staff