在Pyrocms中管理登录重定向 [英] Manage Login Redirection in Pyrocms

查看:137
本文介绍了在Pyrocms中管理登录重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以这样一种方式管理登录,以便在成功登录后将控件重定向到在pyrocms中调用login方法的页面。



默认情况下,控制到主页。例如我想去图库页面,但它要求用户登录,因此它会重定向控制到登录页面,现在我想重定向控件回到图库页面,一旦用户成功登录。

解决方案

最后,我得到了对我来说正确的解决方案。



每当用户尝试查看需要用户登录的图库页面(受限页面)时,我们只能在控制器方法中的$ redirect_to中成功登录后才分配要重定向的URL:

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

然后它会自动将控件重定向到所需的页面。因为在用户控制器中,登录功能是以如下方式开发的:

  $ redirect_to = $ this-& > post('redirect_to')? $ this-> input-> post('redirect_to'):$ this-> session-> userdata('redirect_to');希望这有助于你有时候

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.

解决方案

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

这篇关于在Pyrocms中管理登录重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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