Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding email confirmation

  • Loading branch information...
commit 4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0 1 parent a18d95c
@danejensen danejensen authored
View
2  src/app.yaml
@@ -1,4 +1,4 @@
-application: myflaskonappengineapp
+application: subscribely
version: 1
runtime: python27
api_version: 1
View
16 src/application/templates/emails/confirmation.html
@@ -0,0 +1,16 @@
+<html>
+<body>
+
+<p>Thank you for joining the Sock Club. We will be delivering your first pair of socks soon.</p>
+<p>Please like us on facebook or tweet about us.</p>
+<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.sotmclub.com&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=157996907603670" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
+<iframe allowtransparency="true" frameborder="0" scrolling="no"
+ src="http://platform.twitter.com/widgets/tweet_button.html?url=http://www.sotmclub.com"
+ style="margin-top: 10px; width:130px; height:20px;"></iframe>
+
+<p>Kick off your shoes and relax your socks</p>
+
+<p>Love,</p>
+<p>The Sock Club Guys</p>
+</body>
+</html>
View
6 src/application/templates/emails/confirmation.txt
@@ -0,0 +1,6 @@
+Thank you for joining the Sock of the Month Club. We will be delivering you the finest socks shortly.
+
+Kick off your shoes and relax your socks.
+
+Love,
+The Sock Club Guys
View
2  src/application/templates/includes/nav.html
@@ -13,7 +13,7 @@
<a href="http://www.sotmclub.com/">Sock Club</a>
</li>
<li>
- <a href="http://www.sotmclub.com/">Subscribely Source</a>
+ <a href="https://github.com/SockClub/subscribely">Subscribely Source</a>
</li>
<li>
<a href="https://developers.google.com/appengine/docs/python/python27/using27">App Engine docs</a>
View
12 src/application/views.py
@@ -12,8 +12,9 @@
from application import app
from google.appengine.runtime.apiproxy_errors import CapabilityDisabledError
+from google.appengine.api import mail
-from flask import render_template, request, flash, g, url_for, redirect, session
+from flask import render_template, render_template_string, request, flash, g, url_for, redirect, session
from models import MailingAddress
from decorators import admin_required
@@ -23,8 +24,8 @@
from flaskext.oauth import OAuth
import stripe
-FACEBOOK_APP_ID = '445467548819678'
-FACEBOOK_APP_SECRET = '6c176bb309a8bccd9ffd7ca9b3cf21f3'
+FACEBOOK_APP_ID = '445106095520759'
+FACEBOOK_APP_SECRET = 'b89cacf4ea4fdb08fed9f1d2f71a98a6'
STRIPE_SECRET = 'oqfhEnnahozCOBvY0ZtxRNs9Arb4GrXG'
STRIPE_PUB_KEY = 'pk_V5tvgwqsXfUlNrKwYrhE9SlqzHRLO'
@@ -191,6 +192,11 @@ def subscribe():
m = MailingAddress(username=user.username, name=form.name.data, address1 = form.address1.data,\
address2=form.address2.data, zipcode=form.zipcode.data, city=form.city.data, state=form.state.data, country=form.country.data)
m.put()
+ context = dict()
+ bodytext = render_template_string('emails/confirmation.txt', context=context)
+ bodyhtml = render_template('emails/confirmation.html', context=context)
+ mail.send_mail(sender="<welcome@sotmclub.com>", to=user.username,
+ subject="Welcome to the Club", body=bodytext, html=bodyhtml)
return redirect(url_for('account'))
return render_template('subscribe.html', form=form, pub_key=STRIPE_PUB_KEY)
Please sign in to comment.
Something went wrong with that request. Please try again.