i developed a access control with MFA. the problem is that the mfa is regarding the correct mfa code as incorrect
I tried changing the authenticator and made some changes to the code hoping it could accept the correct Mfa
@app.route('/verifyMFA', methods=['POST'])
def verify_mfa():
"""Returns the page where you enter MFA Code"""
return render_template('verifyMFA.html')
@app.route('/confirmLogin', methods=['POST'])
def confirm_login():
"""Called by web application to verify if MFA Code is correct"""
mfacode = request.form['mfacode']
totpauth = totp.TOTP(app.secret_key)
if totpauth.verify(mfacode):
write_log(f"User {session['name']} logged into the system.")
flash('You have successfully logged in.', 'success')
if session['role'] == 'admin':
return redirect(url_for('user_mgt'), code=307)
else:
return redirect('/')
else:
flash('incorrect MFA Code entered. Try Again!', 'error')
return redirect('/login')
THATS THE CODE
New contributor
Kundai Kuvengurwa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.