【发布时间】:2014-10-03 02:21:10
【问题描述】:
我为另一个 API 复制了 Google 身份验证插件,但由于某种原因,它没有在 Joomla 中保存记录。如果我手动添加用户名和一些随机密码,那么我的插件会正确地针对 API 进行身份验证 - 但否则在尝试登录时我会收到错误消息:“您无法访问此站点的私人部分。”
我不一定要寻求编码帮助,我只是想知道 Google 身份验证插件是如何保存记录的。我已经通过插件多次寻找它,但我没有看到它。 我必须假设它与 $response 有关,但我正在设置 google auth 的每个值。调用什么来保存记录?
编辑:
好的,显然我不知道用户是如何登录到 Joomla 的。为什么这不起作用??
public function onUserAuthenticate($credentials, $options, &$response) {
// Load plugin language
$this->loadLanguage();
if (empty($credentials['password'])) {
$response->status = JAuthentication::STATUS_FAILURE;
$response->error_message = JText::_('JGLOBAL_AUTH_EMPTY_PASS_NOT_ALLOWED');
return false;
} else {
$response->status = JAuthentication::STATUS_SUCCESS;
$response->error_message = '';
$response->type = 'Mysite';
$response->email = $credentials['username'];
$response->username = $credentials['username'];
$response->fullname = $credentials['username'];
}
}
【问题讨论】: