简体   繁体   English

Joomla身份验证返回URL

[英]Joomla authentication Return URL

Am trying to modify an already heavily modified joomla environment. 我正在尝试修改一个已经大量修改的joomla环境。 I am not a Joomla dev so am a little lost in the wilderness, so to speak. 我不是Joomla开发人员,所以可以说在荒野中有些迷茫。

Basically, 99% of the site consists of articles with Access Level = Registered. 基本上,该站点的99%包含访问级别=已注册的文章。 When you hit the URL of one of these articles, Joomla redirects to an auth page. 当您点击其中一篇文章的URL时,Joomla会重定向到身份验证页面。 That makes sense, except the URL to the original article is lost so after login, you are redirected back to the homepage and not the article originally intended. 这是有道理的,除了原始文章的URL丢失了,因此登录后,您将被重定向回首页,而不是最初打算的文章。

Now, I can see that the error.php page has been modified with code to intercept a 403 error, and this looks like it should work. 现在,我可以看到error.php页面已用代码修改,以拦截403错误,这看起来应该可以工作。 BUT, somehow/somewhere Joomla is redirecting to the auth page in some other way, and no 403 is ever thrown. 但是,以某种方式/某处Joomla正在以其他方式重定向到身份验证页面,并且不会抛出403。

So my question is, how does Joomla perform the redirect to the auth page (a custom plugin btw), and is there any way for Joomla to instead throw the 403 error so I can use the logic already coded in error.php. 所以我的问题是,Joomla如何执行重定向到身份验证页面(自定义插件btw)的操作,并且Joomla有什么方法可以代替抛出403错误,以便我可以使用在error.php中已经编码的逻辑。

Thanks in advance 提前致谢

ps it's Joomla 1.5.23 and PHP 5.2.17 ps是Joomla 1.5.23和PHP 5.2.17

Joomla! Joomla! 1.5 uses a fairly comprehensive .htaccess file and as Joel said this happens before Joomla! 1.5使用了一个相当全面的.htaccess文件,正如Joel所说的,这发生在Joomla之前! gets a look in. 看看。

A standard Joomla! 一个标准的Joomla! 1.5 installation will redirect to the correct content after a users logins if the relevant component is written correctly (like the standard com_content for articles). 如果相关组件的编写正确(例如文章的标准com_content ),则在用户登录后1.5安装将重定向到正确的内容。 I would start by looking at why that isn't working eg has the auth check been modified for some reason. 我将首先查看为什么该方法不起作用,例如,由于某种原因修改了auth检查。

Joomla! Joomla! 1.5 normally does this by attaching a return parameter (base64 encoded), to the URL that is used to call com_user , you can find in most components code like this to check if the users has access and if not redirect them. 1.5通常通过在用于调用com_user的URL上附加一个return参数(base64编码)来实现此com_user ,您可以在大多数组件代码中找到类似的代码来检查用户是否有权访问,以及是否无法重定向用户。

if (($contact->access > $user->get('aid', 0)) || ($contact->category_access > $user->get('aid', 0))) {
    $uri        = JFactory::getURI();
    $return     = $uri->toString();

    $url  = 'index.php?option=com_user&view=login';
    $url .= '&return='.base64_encode($return);

    $mainframe->redirect($url, JText::_('You must login first') );
}

A 403 error is on the HTTP level. HTTP级别出现403错误 It is thrown when a user tries to access a part of a server he does not have access to. 当用户尝试访问他无权访问的服务器的一部分时,将引发该错误。 These permissions are completely different from Joomla permissions. 这些权限与Joomla权限完全不同。 Most of the time, a 403 error only comes from a restriction in a .htaccess file, or when a script tells the server to throw a 403 error (see code below). 在大多数情况下,403错误仅来自.htaccess文件中的限制,或者是脚本告诉服务器抛出403错误(请参见下面的代码)。

I'm not a Joomla expert, but you should be able to throw a 403 error when a user goes to the auth page. 我不是Joomla专家,但是当用户转到身份验证页面时,您应该能够引发403错误。 This PHP code should do the trick: 这个PHP代码应该可以解决问题:

header("HTTP/1.0 403 Forbidden");

Hope this helps you. 希望这对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM