Move verification key generation to view

Instead of creating the email verication key on the db
model as a default for the field, create it in the
registration view.
Now all verification key generation is only in
auth/views.py!
This commit is contained in:
Elrond 2011-12-25 20:11:09 +01:00
parent 0c0ab32274
commit 479e8a833b
2 changed files with 1 additions and 2 deletions

View File

@ -84,6 +84,7 @@ def register(request):
user.email = email
user.pw_hash = auth_lib.bcrypt_gen_password_hash(
request.POST['password'])
user.verification_key = unicode(uuid.uuid4())
user.save(validate=True)
# log the user in

View File

@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
import uuid
from mongokit import Document
@ -88,7 +87,6 @@ class User(Document):
'created': datetime.datetime.utcnow,
'email_verified': False,
'status': u'needs_email_verification',
'verification_key': lambda: unicode(uuid.uuid4()),
'is_admin': False}
def check_login(self, password):