Skip to content

Commit

Permalink
Fix mixed typing on 126 and 296 by forcing to string or bool
Browse files Browse the repository at this point in the history
  • Loading branch information
kbwhizz committed Nov 25, 2024
1 parent b86a645 commit abee9ab
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ public function genQRcode(): array
$qrinfo = array();
$google2fa = new Google2FA();
$qrinfo['secret'] = $google2fa->generateSecretKey();
$data = 'otpauth://totp/' . $this->user_id . '?secret=' . $qrinfo['secret'] . '&issuer=' . $_SERVER['SERVER_NAME'];
$servername = $_SERVER['SERVER_NAME'];
settype($servername, "string");
$data = 'otpauth://totp/' . $this->user_id . '?secret=' . $qrinfo['secret'] . '&issuer=' . $servername;
$qrcode = new QRCode();
$qrinfo['qrcode'] = $qrcode->render($data);
return $qrinfo;
Expand Down Expand Up @@ -291,8 +293,11 @@ public function check2facode(string $code2fa): bool
$secret = DB::table('user')
->where('user_id', '=', $this->id())
->value('secret');
settype($secret, "string");
$google2fa = new Google2FA();
if ($google2fa->verifyKey($secret, $code2fa)) {
$googleverifystatus = $google2fa->verifyKey($secret, $code2fa);
settype($googleverifystatus, "bool");
if ($googleverifystatus) {
return true;
}
return false;
Expand Down

0 comments on commit abee9ab

Please sign in to comment.