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:
parent
0c0ab32274
commit
479e8a833b
@ -84,6 +84,7 @@ def register(request):
|
|||||||
user.email = email
|
user.email = email
|
||||||
user.pw_hash = auth_lib.bcrypt_gen_password_hash(
|
user.pw_hash = auth_lib.bcrypt_gen_password_hash(
|
||||||
request.POST['password'])
|
request.POST['password'])
|
||||||
|
user.verification_key = unicode(uuid.uuid4())
|
||||||
user.save(validate=True)
|
user.save(validate=True)
|
||||||
|
|
||||||
# log the user in
|
# log the user in
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import uuid
|
|
||||||
|
|
||||||
from mongokit import Document
|
from mongokit import Document
|
||||||
|
|
||||||
@ -88,7 +87,6 @@ class User(Document):
|
|||||||
'created': datetime.datetime.utcnow,
|
'created': datetime.datetime.utcnow,
|
||||||
'email_verified': False,
|
'email_verified': False,
|
||||||
'status': u'needs_email_verification',
|
'status': u'needs_email_verification',
|
||||||
'verification_key': lambda: unicode(uuid.uuid4()),
|
|
||||||
'is_admin': False}
|
'is_admin': False}
|
||||||
|
|
||||||
def check_login(self, password):
|
def check_login(self, password):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user