错误的登录尝试后,Joomla 3重定向 [英] Joomla 3 redirect after wrong login try

查看:96
本文介绍了错误的登录尝试后,Joomla 3重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Joomla的登录模块.登录和注销重定向到模块设置中设置的页面.

Iam using the login module of Joomla. Login and Logout redirects to the pages which are set in the modul settings.

我的问题是用户尝试使用错误的用户凭据登录的状态.在这种情况下,用户将被重定向到component/users/?view = login页面.就我而言,此页面未使用,并且也没有像其余页面一样设计.因此,在错误的登录后,我想将用户重定向到上一页.

My problem is the status, where a user tries to login with wrong user credentials. In this case, the user will be redirected to component/users/?view=login page. In my case, this page is not in use and also not designed like the rest of the pages. Therefore I would like to redirect the user, after a wrong login, to the previous page.

有人知道如何解决吗?

thx

推荐答案

您将需要修改用户控制器.但是要使其保持更新证明",您不能修改核心代码,这就是我们进行覆盖的原因:

You will need to modify users controller. But to keep it "update proof" you cannot modify the core code, thats why we will make an override:

  1. 转到components/com_users/controllers/并复制一个名为user.php的文件,您可以调用一个新文件user2.php
  2. 打开user2.php文件,并将控制器类重命名为UsersControllerUser2
  3. 为您的登录模块创建一个模板替代(也要使其具有更新证明),创建一个templates/YOUR_TEMPLATE/html/mod_login文件夹,然后在其中复制modules/mod_login/tmpl/default.php文件.
  4. 打开在步骤3中创建的文件,并将登录模块任务从<input type="hidden" name="task" value="user.login" />更改为<input type="hidden" name="task" value="user2.login" />
  5. 再次打开user2.php文件,并修改这部分代码(约77-82行):
  1. Go to the components/com_users/controllers/ and duplicate a file called user.php, you can call a new file user2.php
  2. Open user2.php file and rename controller class to UsersControllerUser2
  3. Create a template override of your login module (to make it update proof also), create a templates/YOUR_TEMPLATE/html/mod_login folder and copy modules/mod_login/tmpl/default.php file there.
  4. Open file created in step 3 and change login module task from <input type="hidden" name="task" value="user.login" /> to <input type="hidden" name="task" value="user2.login" />
  5. Open user2.php file once again, and modify this part of code (around lines 77-82):

$ app-> redirect(JRoute :: _('index.php?option = com_users& view = login', 错误));

$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));

$app->redirect路线更改为您想要的任何地方:)

Change $app->redirect route to whatever you want :)

这篇关于错误的登录尝试后,Joomla 3重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆