Skip to content
Commits on Source (2)
...@@ -429,7 +429,13 @@ def do_login(): ...@@ -429,7 +429,13 @@ def do_login():
user = config.db.query_fetchone( "SELECT username, totp FROM users WHERE username = %s", ( session[ "username" ], ) ) user = config.db.query_fetchone( "SELECT username, totp FROM users WHERE username = %s", ( session[ "username" ], ) )
totp_db = pyotp.TOTP( user[ "totp" ] ) totp_db = pyotp.TOTP( user[ "totp" ] )
totp_user = request.form[ "totp" ] totp_user = request.form.get( "totp", None )
if totp_user == None:
return jsonify( {
"error": True,
"message": "No TOTP provided"
} )
app.logger.info( "TOTP expected now: {}".format( totp_db.now() ) ) app.logger.info( "TOTP expected now: {}".format( totp_db.now() ) )
app.logger.info( "TOTP provided: {}".format( totp_user ) ) app.logger.info( "TOTP provided: {}".format( totp_user ) )
......
...@@ -239,6 +239,12 @@ ...@@ -239,6 +239,12 @@
) )
); );
$( "#login_button" ).on( "click", function( event )
{
event.preventDefault();
login_action_totp();
} );
$( "#totp" ).focus(); $( "#totp" ).focus();
} }
......