[英]Codeigniter Ion Auth login view issue
I have installed Ion_auth
with Codeigniter as user authentication library. 我已经将Ion_auth
与Ion_auth
一起安装为用户身份验证库。 I am facing an issue with auth/login
view. 我正面临auth/login
视图的问题。 If I enter http://localhost/ciinstallation/auth/login
. 如果我输入http://localhost/ciinstallation/auth/login
。 I can still viewing auth/login
page though my session has been registered. 尽管我的会话已注册,但我仍然可以查看auth/login
页面。 Everything works fine except above issue. 除了上述问题,一切正常。 My question is that - Why I can see the login page? 我的问题是-为什么我可以看到登录页面?
As a logged in user- I shouldn't see the login page anymore. 作为已登录的用户,我应该再也看不到登录页面。 What I am doing wrong? 我做错了什么?
Configuration Info as follows- 配置信息如下-
Auth.php
includes Auth
Controller extends CI_Controller Auth.php
包括Auth
Controller扩展了CI_Controller Ion_auth_model
include Ion_auth_model
extends CI_Model Ion_auth_model
包含Ion_auth_model
扩展CI_Model I have tested by dumping logged in user information in welcome view. 我已经通过将登录的用户信息转储到欢迎视图中进行了测试。 Data showing properly. 数据显示正确。
Thanks in advance. 提前致谢。
In your auth
controller method login
you should first check if you are currently logged in before showing the login form: 在您的auth
控制器方法login
,应首先检查您当前是否登录,然后再显示登录表单:
if ($this->ion_auth->logged_in())
{
// Example: redirect them to the dashboard page
redirect('dashboard');
}
If you are logged in then you should be redirected to any Logged-in only page you want. 如果您已登录,则应将您重定向到所需的任何“仅登录”页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.