Skip to content

Commit

Permalink
Adding email confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
danejensen committed Jul 17, 2012
1 parent a18d95c commit 4d6ac60
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app.yaml
@@ -1,4 +1,4 @@
application: myflaskonappengineapp
application: subscribely
version: 1
runtime: python27
api_version: 1
Expand Down
16 changes: 16 additions & 0 deletions 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>
6 changes: 6 additions & 0 deletions 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
2 changes: 1 addition & 1 deletion src/application/templates/includes/nav.html
Expand Up @@ -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>
Expand Down
12 changes: 9 additions & 3 deletions src/application/views.py
Expand Up @@ -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
Expand All @@ -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'

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 4d6ac60

Please sign in to comment.