Joomla排忧解难. 无效令牌错误
March 14, 2012
和Joomla合作 website 你可以看到无效的 Token error message. 在这篇文章中,我们将描述这个错误并提供一些解决它的方法.
什么是代币 ?
代币最初是随着《og体育》进入Joomla的.5.3. 它们是作为表单的安全特性引入的. 在Joomla上提交的任何表单 website, a token 被期望通过. 如果这是不正确的或缺失的,您将得到一个Invalid Token error. 这真的很好,因为它阻碍了 Spam & hack attempts.
有什么影响 ?
Joomla中的所有形式都受此影响. 这个错误在登录中更明显 & 这些注册表格是最常用的.
为什么我们得到无效令牌错误 ?
你得到这个错误的原因有很多,这里列出了最常见的原因:
过期的饼干: Joomla希望您拥有的cookie已经过期. Deleting your cookies 尝试再次登录将解决这个问题.
Caching:
- 完全禁用缓存. 这是一个两步的过程:
- 登录到Joomla控制面板,转到 Site, 全局配置, System,然后点击“否” Cache under Cache Settings and
- 禁用系统 cache plugin, by going to Extensions,Plugins,然后搜索 System – Cache and click the checkbox 在它旁边,最后点击 Disable 在右上方.
- 自己修复登录代码(或其他您遇到问题的功能), 的检查注释掉 token.
在表单文件中找到以下代码:
然后用
使用遗留模式(Joomla 1).0 mode)已知在Legacy模式下使用Joomla会导致此问题. 只需禁用遗留模式 plugin.
使用遗留代码检查令牌:部分版本的Joomla/Joomla模板 提供一些遗留代码来检查令牌. 这个代码需要修改. 下面是解决这个问题的方法:
- 打开文件 /模块/ mod_login / tmpl /违约.php 改变路线 to access token is an opaque string that identifies a user, app, or page and can be used by the app to make graph API calls. Access tokens are obtained via a number of methods.
A token is used to make security decisions and to store information about some system entity. While a token is generally used to represent only security information, it is capable of holding additional free-form data that can be attached while the token is being created. Tokens can be duplicated without special(...) " onclick="window.open('http://uddm.ngskmc-eis.net/help/glossary/token/', '_blank')">token’ ); ?> - 在许多情况下,登录 module 是否被模板覆盖, 你需要检查模板中的代码看看它是否使用了 JUtility: getToken (); 然后把它变成 JHTML:: _(的形式.token’ );
Disabled cookies on browser: If cookies 在你的 browser 然后你肯定会看到这个问题. Enabling cookies will fix it.