109638656: Implement two factor verify flow

When user enters valid sms code they are redirected to the dashboard.
Otherwise, form errors are present.
This commit is contained in:
Rebecca Law
2015-12-08 12:36:54 +00:00
parent c946f85f9d
commit 2e59870490
6 changed files with 63 additions and 17 deletions

View File

@@ -1,7 +1,8 @@
from flask import render_template, redirect, jsonify
from flask import render_template, redirect, jsonify, session
from flask_login import login_user
from app.main import main
from app.main.dao import users_dao
from app.main.forms import TwoFactorForm
@@ -15,6 +16,8 @@ def process_two_factor():
form = TwoFactorForm()
if form.validate_on_submit():
user = users_dao.get_user_by_id(session['user_id'])
login_user(user)
return redirect('/dashboard')
else: