Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Oct 3, 2014
1 parent 2cfa758 commit d66e327
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gratipay/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"""
from __future__ import print_function, unicode_literals

from datetime import timedelta
from decimal import Decimal, ROUND_DOWN, ROUND_HALF_EVEN
import uuid

import aspen
from aspen.utils import typecheck, utcnow
from datetime import timedelta
from postgres.orm import Model
from psycopg2 import IntegrityError

Expand Down Expand Up @@ -576,18 +576,20 @@ def verify_email(self, hash_string):
original_hash = getattr(self.email, 'hash', '')
email_ctime = getattr(self.email, 'ctime', '')
if (original_hash == hash_string) and ((utcnow() - email_ctime) < EMAIL_HASH_TIMEOUT):
self.update_email(self.email.address,True)
self.update_email(self.email.address, True)
return 0 # Verified
elif (original_hash == hash_string):
return 1 # Expired
else:
return 2 # Failed

def get_verification_link(self):
hash_string = self.email.hash
scheme = gratipay.canonical_scheme
host = gratipay.canonical_host
hash = self.email.hash
username = self.username_lower
link = "%s://%s/%s/verify-email.html?hash=%s" % (gratipay.canonical_scheme, gratipay.canonical_host, username, hash_string)
return link
link = "{scheme}://{host}/{username}/verify-email.html?hash={hash}"
return link.format(**locals())

def send_email(self, message, **params):
message['from_email'] = '[email protected]'
Expand Down

0 comments on commit d66e327

Please sign in to comment.