Joomla 如何禁用TFA(双因素身份验证)
我在Joomla 3.2中启用了TFA,工作正常,但我的智能手机无法访问 然后我无法进入后端,我试图在数据库中禁用插件plg_twofactorauth_totp,但它保持启用状态Joomla 如何禁用TFA(双因素身份验证),joomla,google-authenticator,Joomla,Google Authenticator,我在Joomla 3.2中启用了TFA,工作正常,但我的智能手机无法访问 然后我无法进入后端,我试图在数据库中禁用插件plg_twofactorauth_totp,但它保持启用状态 通过重命名文件夹隐藏密钥输入禁用,但我无法登录。转到joomla的MySQL数据库,转到用户表。清除otpKey的值。您现在应该可以不用钥匙登录。 此代码将禁用双因素身份验证插件并清除Joomla的密钥!超级用户 这个脚本禁用了Joomlas双因素身份验证插件,并为超级用户清除otpKey和otep值。当您因任何原因
通过重命名文件夹隐藏密钥输入禁用,但我无法登录。转到joomla的MySQL数据库,转到用户表。清除otpKey的值。您现在应该可以不用钥匙登录。 此代码将禁用双因素身份验证插件并清除Joomla的密钥!超级用户 这个脚本禁用了Joomlas双因素身份验证插件,并为超级用户清除otpKey和otep值。当您因任何原因无法使用Google authenticator时,它允许您登录 用法: 把它放在Joomla!3.x根目录(其中configuration.php和index.php是)并运行它。然后登录并将安全密钥字段留空 警告:小心使用。使用前备份强> 代码快照
<?php
/* This script disables Joomla!'s two factor authentication
* plugin and clears the otpKey and otep values for Super
* Users. It allows you to login when you aren't able to
* use Google authenticator for any reason.
* Usage:
* Place it in the Joomla! 3.x root dir (where configuration.php
* and index.php are) and run it. Then login and leave the
* security key field empty.
* Warning: Use with caution. Backup before use.
*/
define('_JEXEC', 1);
define('JPATH_BASE', __DIR__);
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load system defines
if (file_exists(JPATH_BASE . '/defines.php')) { require_once JPATH_BASE . '/defines.php'; }
if (!defined('_JDEFINES')) { require_once JPATH_BASE . '/includes/defines.php'; }
require_once JPATH_LIBRARIES . '/import.legacy.php'; // Get the framework.
require_once JPATH_LIBRARIES . '/cms.php'; // Bootstrap the CMS libraries.
class Reset2FA extends JApplicationCli
{
public function execute()
{
$this->out('Initialising');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query2 = $db->getQuery(true);
//get users by group: (array of integers)
$sadminids = JAccess::getUsersByGroup(8); // 8 = Super Users
$strsadminids = implode(',', $sadminids);
$this->out(sprintf('Super User IDs: %s', $strsadminids));
$this->out('Disabling twofactorauth plugin (totp and yubikey)');
// Fields to update.
$fields = array(sprintf('%s = 0', $db->quoteName('enabled')));
// Conditions for which records should be updated.
// plg_twofactorauth_totp
// plg_twofactorauth_yubikey
$conditions = array(sprintf('%s LIKE %s', $db->quoteName('name'), $db->quote('plg_twofactorauth_%')));
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$result = $db->execute();
$this->out('Disabling/clearing otpKey and otep for all Super Users');
// UPDATE 2
$fields2 = array(
$db->quoteName('otpKey') . " = ''",
$db->quoteName('otep') . " = ''",
);
// Conditions for which records should be updated.
// otpKey
// otep
$conditions2 = array(
$db->quoteName('otpKey') . " != ''",
$db->quoteName('otep') . " != ''",
sprintf('%s IN (%s)', $db->quoteName('id'), $strsadminids)
);
$query2->update($db->quoteName('#__users'))->set($fields2)->where($conditions2);
$db->setQuery($query2);
$result2 = $db->execute();
$this->out('Done');
}
}
JApplicationCli::getInstance('Reset2FA')->execute();
?>
我不确定是否需要将整个代码发布到GistGithub(?)好了,我认为现在更好了。谢谢