Dot-Notation for Users.email_verified
This commit is contained in:
parent
9047b254f3
commit
4facc7a0a2
@ -168,7 +168,7 @@ def verify_email(request):
|
|||||||
|
|
||||||
if user and user['verification_key'] == unicode(request.GET['token']):
|
if user and user['verification_key'] == unicode(request.GET['token']):
|
||||||
user[u'status'] = u'active'
|
user[u'status'] = u'active'
|
||||||
user[u'email_verified'] = True
|
user.email_verified = True
|
||||||
user[u'verification_key'] = None
|
user[u'verification_key'] = None
|
||||||
|
|
||||||
user.save()
|
user.save()
|
||||||
@ -249,7 +249,7 @@ def forgot_password(request):
|
|||||||
{'email': request.POST['username']})
|
{'email': request.POST['username']})
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
if user['email_verified'] and user['status'] == 'active':
|
if user.email_verified and user['status'] == 'active':
|
||||||
user[u'fp_verification_key'] = unicode(uuid.uuid4())
|
user[u'fp_verification_key'] = unicode(uuid.uuid4())
|
||||||
user[u'fp_token_expire'] = datetime.datetime.now() + \
|
user[u'fp_token_expire'] = datetime.datetime.now() + \
|
||||||
datetime.timedelta(days=10)
|
datetime.timedelta(days=10)
|
||||||
@ -304,7 +304,7 @@ def verify_forgot_password(request):
|
|||||||
if ((user and user['fp_verification_key'] and
|
if ((user and user['fp_verification_key'] and
|
||||||
user['fp_verification_key'] == unicode(formdata_token) and
|
user['fp_verification_key'] == unicode(formdata_token) and
|
||||||
datetime.datetime.now() < user['fp_token_expire']
|
datetime.datetime.now() < user['fp_token_expire']
|
||||||
and user['email_verified'] and user['status'] == 'active')):
|
and user.email_verified and user['status'] == 'active')):
|
||||||
|
|
||||||
cp_form = auth_forms.ChangePassForm(formdata_vars)
|
cp_form = auth_forms.ChangePassForm(formdata_vars)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def adduser(args):
|
|||||||
entry.email = unicode(args.email)
|
entry.email = unicode(args.email)
|
||||||
entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
|
entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
|
||||||
entry['status'] = u'active'
|
entry['status'] = u'active'
|
||||||
entry['email_verified'] = True
|
entry.email_verified = True
|
||||||
entry.save(validate=True)
|
entry.save(validate=True)
|
||||||
|
|
||||||
print "User created (and email marked as verified)"
|
print "User created (and email marked as verified)"
|
||||||
|
@ -163,7 +163,7 @@ def test_register_views(test_app):
|
|||||||
{'username': 'happygirl'})
|
{'username': 'happygirl'})
|
||||||
assert new_user
|
assert new_user
|
||||||
assert new_user['status'] == u'needs_email_verification'
|
assert new_user['status'] == u'needs_email_verification'
|
||||||
assert new_user['email_verified'] == False
|
assert new_user.email_verified == False
|
||||||
|
|
||||||
## Make sure user is logged in
|
## Make sure user is logged in
|
||||||
request = template.TEMPLATE_TEST_CONTEXT[
|
request = template.TEMPLATE_TEST_CONTEXT[
|
||||||
@ -203,7 +203,7 @@ def test_register_views(test_app):
|
|||||||
{'username': 'happygirl'})
|
{'username': 'happygirl'})
|
||||||
assert new_user
|
assert new_user
|
||||||
assert new_user['status'] == u'needs_email_verification'
|
assert new_user['status'] == u'needs_email_verification'
|
||||||
assert new_user['email_verified'] == False
|
assert new_user.email_verified == False
|
||||||
|
|
||||||
## Verify the email activation works
|
## Verify the email activation works
|
||||||
template.clear_test_template_context()
|
template.clear_test_template_context()
|
||||||
@ -217,7 +217,7 @@ def test_register_views(test_app):
|
|||||||
{'username': 'happygirl'})
|
{'username': 'happygirl'})
|
||||||
assert new_user
|
assert new_user
|
||||||
assert new_user['status'] == u'active'
|
assert new_user['status'] == u'active'
|
||||||
assert new_user['email_verified'] == True
|
assert new_user.email_verified == True
|
||||||
|
|
||||||
# Uniqueness checks
|
# Uniqueness checks
|
||||||
# -----------------
|
# -----------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user