Skip to content

Commit

Permalink
fix invalid token after captcha fail (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur committed Jan 6, 2025
1 parent ba318be commit 901c04e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions htdocs/sendsms.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
$sessiontoken = "";
$attempts = 0;

if( isset($_REQUEST["formtoken"]) )
{
$formtoken = strval($_REQUEST["formtoken"]);
}

#==============================================================================
# Verify minimal information for treatment
# Encryption needs to be activated
Expand Down
12 changes: 12 additions & 0 deletions htdocs/sendtoken.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@
# Check tokenform
#==============================================================================

$check_tokenform = false;
if ( !$result ) {
$formtoken = strval($_REQUEST["formtoken"]);
$result = $sspCache->verify_form_token($formtoken);
$check_tokenform = true;
}

#==============================================================================
Expand Down Expand Up @@ -160,6 +162,16 @@
}
}

#==============================================================================
# if:
# * form token has been checked previously (and thus erased) and
# * something bad happened (bad captcha,...)
# regenerate a form token
#==============================================================================
if( $check_tokenform && $result != "" )
{
$formtoken = $sspCache->generate_form_token($cache_form_expiration);
}

#==============================================================================
# Build and store token
Expand Down

0 comments on commit 901c04e

Please sign in to comment.