更新时间:2023-11-27 08:23:52
您将需要修改用户控制器.但是为了保持更新证明",您不能修改核心代码,这就是我们将进行覆盖的原因:
components/com_users/controllers/
复制一个名为user.php
的文件,你可以调用一个新文件user2.php
user2.php
文件并将控制器类重命名为UsersControllerUser2
templates/YOUR_TEMPLATE/html/mod_login
文件夹并复制modules/mod_login/tmpl/default.php
文件在那里.<input type="hidden" name="task" value="user.login"/>
更改为 <input type="hidden" name="task" value="user2.login"/>
$app->redirect(JRoute::_('index.php?option=com_users&view=login',假));
将 $app->redirect
路由更改为您想要的任何内容:)
Iam using the login module of Joomla. Login and Logout redirects to the pages which are set in the modul settings.
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.
Does anybody have a clue, how to solve that?
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:
components/com_users/controllers/
and duplicate a file called user.php
, you can call a new file user2.php
user2.php
file and rename controller class to UsersControllerUser2
templates/YOUR_TEMPLATE/html/mod_login
folder and copy modules/mod_login/tmpl/default.php
file there.<input type="hidden" name="task" value="user.login" />
to <input type="hidden" name="task" value="user2.login" />
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
Change $app->redirect
route to whatever you want :)