我已将Ion_auth
与Codeigniter一起安装为用户身份验证库。我正面临着auth/login
观点的问题。如果我输入http://localhost/ciinstallation/auth/login
。我的会话已经注册,我仍然可以查看auth/login
页面。除上述问题外,一切正常。我的问题是 - 为什么我可以看到登录页面?
作为登录用户 - 我不应该再看到登录页面了。我做错了什么?
配置信息如下 -
Auth.php
包括Auth
Controller扩展CI_Controller Ion_auth_model
包括Ion_auth_model
扩展CI_Model 我通过在欢迎视图中转储登录的用户信息进行了测试。数据显示正确。
提前致谢。
答案 0 :(得分:0)
在auth
控制器方法login
中,首先要检查您当前是否已登录,然后再显示登录表单:
if ($this->ion_auth->logged_in())
{
// Example: redirect them to the dashboard page
redirect('dashboard');
}
如果您已登录,则应将您重定向到所需的任何仅登录页面。