Skip to content

Commit

Permalink
Better implementation to keep sms_max_attempts_token at the same value.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfem committed Apr 18, 2024
1 parent 77cbb4f commit d424cd5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions htdocs/sendsms.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
$token = "";
$sessiontoken = "";
$attempts = 0;
# Because the loop starts at 0 and not at 1
$sms_max_attempts_token = $sms_max_attempts_token - 1;

#==============================================================================
# Verify minimal information for treatment
Expand Down Expand Up @@ -98,7 +96,8 @@
list($result, $token) = obscure_info_sendsms("tokenattempts","tokennotvalid");
error_log("Unable to open session $smstokenid");
} elseif ($sessiontoken != $smstoken) {
if ($attempts < $sms_max_attempts_token) {
# To have only x tries and not x+1 tries
if ($attempts < ($sms_max_attempts_token - 1)) {
$_SESSION['attempts'] = $attempts + 1;
$result = "tokenattempts";
error_log("SMS token $smstoken not valid, attempt $attempts");
Expand Down

0 comments on commit d424cd5

Please sign in to comment.