Skip to content

Commit

Permalink
Changed emails to UNIs: don't want random emails getting spammed
Browse files Browse the repository at this point in the history
  • Loading branch information
thenoviceoof committed Jan 27, 2012
1 parent b313933 commit d2063b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions config.py.template
Expand Up @@ -6,5 +6,7 @@ SIGNIN_TEXT = "SIGN IN TEXT"

ADMIN_EMAIL = "EMAIL"

EMAIL_SUFFIX = ""

# day of the week
RENEW_DATE = "Monday"
15 changes: 11 additions & 4 deletions flyer.py
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions templates/club_edit.html
Expand Up @@ -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>
Expand Down

0 comments on commit d2063b1

Please sign in to comment.