mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
22 lines
544 B
Python
22 lines
544 B
Python
from flask import render_template, redirect, jsonify
|
|
from flask_login import login_user
|
|
|
|
from app.main import main
|
|
from app.main.forms import TwoFactorForm
|
|
|
|
|
|
@main.route("/two-factor", methods=['GET'])
|
|
def render_two_factor():
|
|
return render_template('two-factor.html', form=TwoFactorForm())
|
|
|
|
|
|
@main.route('/two-factor', methods=['POST'])
|
|
def process_two_factor():
|
|
form = TwoFactorForm()
|
|
|
|
if form.validate_on_submit():
|
|
login_user(user)
|
|
return redirect('/dashboard')
|
|
else:
|
|
return jsonify(form.errors), 400
|