From: Andrew Dolgov Date: Mon, 3 Sep 2012 18:32:24 +0000 (+0400) Subject: api: add workaround to disable OTP X-Git-Tag: 1.6.0~73 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=02cd6de12835fb470537b65d0b8adae925dd8bcb;p=tt-rss.git api: add workaround to disable OTP --- diff --git a/api/index.php b/api/index.php index 2d555678..c3199857 100644 --- a/api/index.php +++ b/api/index.php @@ -14,6 +14,8 @@ require_once "db-prefs.php"; require_once "functions.php"; + define('AUTH_DISABLE_OTP', true); + if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) { diff --git a/classes/auth/internal.php b/classes/auth/internal.php index da2d3668..0254d60e 100644 --- a/classes/auth/internal.php +++ b/classes/auth/internal.php @@ -9,43 +9,45 @@ class Auth_Internal extends Auth_Base { $otp = db_escape_string($_REQUEST["otp"]); if (get_schema_version($this->link) > 96) { - $result = db_query($this->link, "SELECT otp_enabled,salt FROM ttrss_users WHERE - login = '$login'"); - - 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; + if (!defined('AUTH_DISABLE_OTP') || !AUTH_DISABLE_OTP) { + $result = db_query($this->link, "SELECT otp_enabled,salt FROM ttrss_users WHERE + login = '$login'"); + + 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 - -
- - - - - - - -
- -