Permalink
Browse files

Changed emails to UNIs: don't want random emails getting spammed

  • Loading branch information...
1 parent b313933 commit d2063b11368cb424d7255b8c60aac516fd60ae7c @thenoviceoof committed Jan 27, 2012
Showing with 15 additions and 6 deletions.
  1. +2 −0 config.py.template
  2. +11 −4 flyer.py
  3. +2 −2 templates/club_edit.html
View
@@ -6,5 +6,7 @@ SIGNIN_TEXT = "SIGN IN TEXT"
ADMIN_EMAIL = "EMAIL"
+EMAIL_SUFFIX = ""
+
# day of the week
RENEW_DATE = "Monday"
View
@@ -25,6 +25,11 @@
################################################################################
# utility fns
+# YOU WILL HAVE TO REPLACE THIS IF YOU DON'T GO TO COLUMBIA
+# this checks the format of the UNI, which all columbia emails adhere to
+def check_email(email):
+ return re.match("\w{2,3}\d{4}", email)
+
def generate_hash(base):
seed = base + str(time.time())
md5 = hashlib.md5()
@@ -265,8 +270,11 @@ def post(self, club_id):
club = Club.get_by_key_name(club_id)
# add emails
email_block = self.request.get("newemails")
- emails = [e for e in re.split("[\s\,\n]", email_block) if e]
+ emails = [e for e in re.split("[\s\,\n]", email_block)
+ if e and check_email(e)]
for email in emails:
+ # add a suffix
+ email += EMAIL_SUFFIX
# don't use hashes for emails, never access anyways
email_obj = Email.get_or_insert(email)
if not(email_obj.email):
@@ -281,13 +289,12 @@ def post(self, club_id):
join = EmailToClub(email=email_obj, club=club)
join.put()
- # !!! remove emails
- # !!! update attached messages
-
# create message
add_notify("Notice", "Emails added")
self.redirect("/club/%s" % club.slug)
+# !!! remove emails w/ AJAX?
+
class AttachGoogleAccount(BaseHandler):
# for allowing expedient usage: auto-sign in users
def get(self):
@@ -25,8 +25,8 @@ <h2 id="noemails">oops, no members yet! Add some below!</h2>
{% endif %}
<div id="newwrapper">
- <h2>Add emails to the list</h2>
- <p>Copy paste the list of emails below</p>
+ <h2>Add UNIs to the list</h2>
+ <p>Copy paste the list of UNIs below</p>
<form id="newmembers" method="post">
<textarea name="newemails"></textarea>
<button>Add emails</button>

0 comments on commit d2063b1

Please sign in to comment.