重定向权限错误 Joomla 3

Redirect on Permission Error Joomla 3

问题

未经许可访问页面会出现错误信息:

You do not have permission to view this resource. Please contact the Site Administrator.

但是,它应该重定向到 /login

Joomla 解决方案

将给定菜单项的权限设置为已注册,未注册的人将被重定向到您的登录页面。

代码解决方案:

如果你想打破常规并用代码实现它,你可以将以下代码添加到你的模板中:

if ($('.cAlert:contains("You do not have permission to view this resource.")').length) {
    window.location.href = "/login";
};