Working tests, hopefully all code changes done.

This commit is contained in:
Nicholas Staples
2016-01-27 12:22:32 +00:00
parent ce81a6f540
commit 6959d695d3
57 changed files with 1143 additions and 1578 deletions

View File

@@ -11,7 +11,7 @@ from client.errors import HTTPError
from flask_login import login_user
from app.main import main
from app.main.dao import users_dao, verify_codes_dao
from app.main.dao import users_dao
from app.main.forms import VerifyForm
@@ -20,12 +20,11 @@ def verify():
# TODO there needs to be a way to regenerate a session id
# or handle gracefully.
user_id = session['user_details']['id']
codes = verify_codes_dao.get_codes(user_id)
form = VerifyForm(codes)
if form.validate_on_submit():
verify_codes_dao.use_code_for_user_and_type(user_id=user_id, code_type='email')
verify_codes_dao.use_code_for_user_and_type(user_id=user_id, code_type='sms')
def _check_code(code, code_type):
return users_dao.check_verify_code(user_id, code, code_type)
form = VerifyForm(_check_code)
if form.validate_on_submit():
try:
user = users_dao.get_user_by_id(user_id)
activated_user = users_dao.activate_user(user)