简体   繁体   English

Codeigniter离子验证登录视图问题

[英]Codeigniter Ion Auth login view issue

I have installed Ion_auth with Codeigniter as user authentication library. 我已经将Ion_authIon_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- 配置信息如下-

  1. Auth.php includes Auth Controller extends CI_Controller Auth.php包括Auth Controller扩展了CI_Controller
  2. Ion_auth_model include Ion_auth_model extends CI_Model Ion_auth_model包含Ion_auth_model扩展CI_Model
  3. Language configured properly 语言配置正确
  4. I loaded library @ autoload.php @ config directory. 我加载了库@ autoload.php @ config目录。
  5. Database connected properly (I can login). 数据库已正确连接(我可以登录)。 I can add new user. 我可以添加新用户。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM