mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Working tests, hopefully all code changes done.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user