Manage Login Redirection in Pyrocms

谁都会走 提交于 2019-12-22 09:19:47

问题


I need to manage login in such a way that it should redirect the control after successful login to the page which call login method in pyrocms.

By default it return control to Home Page. for example i want to go gallery page but it require user to be logged in so it will redirect control to the login page and now i want to redirect the control back to the gallery page once the user successful logged in.


回答1:


Finally, i have come with the exact solution which is working correctly for me.

Whenever user try to view the gallery page(restricted page) which require user login, we have to only assign the URL where we want to redirect after successful login in $redirect_to in the controller method:

$this->session->set_userdata('redirect_to',$redirect_to);

Then it will automatically redirect the control to the desired page. Because in the users controller the login function is developed in such a way that:

$redirect_to = $this->input->post('redirect_to') ? $this->input->post('redirect_to') : $this->session->userdata('redirect_to');

Hopefully this will help you sometime



来源:https://stackoverflow.com/questions/10328141/manage-login-redirection-in-pyrocms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!