Review comment fixes.

This commit is contained in:
Nicholas Staples
2016-01-28 11:34:15 +00:00
parent ca8d78aee5
commit e322a5f1c3
2 changed files with 11 additions and 7 deletions

View File

@@ -20,13 +20,15 @@ def two_factor():
form = TwoFactorForm(_check_code)
if form.validate_on_submit():
user = users_dao.get_user_by_id(user_id)
# Check if coming from new password page
if 'password' in session['user_details']:
user.set_password(session['user_details']['password'])
users_dao.update_user(user)
del session['user_details']
login_user(user)
try:
user = users_dao.get_user_by_id(user_id)
# Check if coming from new password page
if 'password' in session['user_details']:
user.set_password(session['user_details']['password'])
users_dao.update_user(user)
login_user(user)
finally:
del session['user_details']
return redirect(url_for('.choose_service'))
return render_template('views/two-factor.html', form=form)