From: Andrew Dolgov Date: Mon, 3 Sep 2012 14:53:19 +0000 (+0400) Subject: auth internal: fix login screen warning X-Git-Tag: 1.6.0~74 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4e70344bbf4d7e2d0a9e5a87c6c10973b519cafa;p=tt-rss.git auth internal: fix login screen warning --- diff --git a/classes/auth/internal.php b/classes/auth/internal.php index a4e8b471..da2d3668 100644 --- a/classes/auth/internal.php +++ b/classes/auth/internal.php @@ -12,39 +12,41 @@ class Auth_Internal extends Auth_Base { $result = db_query($this->link, "SELECT otp_enabled,salt FROM ttrss_users WHERE login = '$login'"); - require_once "lib/otphp/vendor/base32.php"; - require_once "lib/otphp/lib/otp.php"; - require_once "lib/otphp/lib/totp.php"; - - $base32 = new Base32(); - - $otp_enabled = sql_bool_to_bool(db_fetch_result($result, 0, "otp_enabled")); - $secret = $base32->encode(sha1(db_fetch_result($result, 0, "salt"))); - - $topt = new \OTPHP\TOTP($secret); - $otp_check = $topt->now(); - - if ($otp_enabled) { - if ($otp) { - if ($otp != $otp_check) { - return false; + if (db_num_rows($result) > 0) { + require_once "lib/otphp/vendor/base32.php"; + require_once "lib/otphp/lib/otp.php"; + require_once "lib/otphp/lib/totp.php"; + + $base32 = new Base32(); + + $otp_enabled = sql_bool_to_bool(db_fetch_result($result, 0, "otp_enabled")); + $secret = $base32->encode(sha1(db_fetch_result($result, 0, "salt"))); + + $topt = new \OTPHP\TOTP($secret); + $otp_check = $topt->now(); + + if ($otp_enabled) { + if ($otp) { + if ($otp != $otp_check) { + return false; + } + } else { + ?> + Tiny Tiny RSS + +
+ + + + + + + +
+ + - Tiny Tiny RSS - -
- - - - - - - -
- -