Skip to content

Commit

Permalink
Resolved an issue in the SQL query responsible for enabling and disab…
Browse files Browse the repository at this point in the history
…ling two-factor authentication on Passky Servers utilizing the MySQL engine.
  • Loading branch information
zigazajc007 committed Feb 24, 2023
1 parent 33c817f commit 6aa9377
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ public static function enable2Fa(string $username, string $token) : string{
try{
$conn = Settings::createConnection();

$stmt = $conn->prepare('UPDATE users SET "2fa_secret" = :secret, backup_codes = :codes WHERE username = :username');
$stmt = $conn->prepare('UPDATE users SET `2fa_secret` = :secret, backup_codes = :codes WHERE username = :username');
$stmt->bindParam(':secret', $secret, PDO::PARAM_STR);
$stmt->bindParam(':codes', $codes, PDO::PARAM_STR);
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
Expand Down Expand Up @@ -807,7 +807,7 @@ public static function disable2Fa(string $username, string $token) : string{
try{
$conn = Settings::createConnection();

$stmt = $conn->prepare('UPDATE users SET "2fa_secret" = null WHERE username = :username');
$stmt = $conn->prepare('UPDATE users SET `2fa_secret` = null WHERE username = :username');
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->execute();

Expand Down
2 changes: 1 addition & 1 deletion server/src/website/actions/editAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}

if($disable2fa){
$stmt = $conn->prepare('UPDATE users SET "2fa_secret" = null, yubico_otp = null, backup_codes = null WHERE username = :username');
$stmt = $conn->prepare('UPDATE users SET `2fa_secret` = null, yubico_otp = null, backup_codes = null WHERE username = :username');
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->execute();
}
Expand Down

0 comments on commit 6aa9377

Please sign in to comment.