dptrmt4366 2019-07-17 09:29
浏览 83

使用auth登录后,Kohana 3.3显示用户未登录

I have a small app written in kohana 3.3. For login purposes I use auth module to log in as user.

Log in is simple and looks like that:

$auth = Auth::instance()->login($_POST['login']['username'], $_POST['login']['password']);
if(!$auth){
     // fails + redirect
}else{
     //success + redirect to user account
}

Auth config:

enter image description here

And user data is stored in db (password hashed):

enter image description here

Problem is that auth is log in me with no problem. There is always "success" when I pass correct login and password. But after that I redirect user to account and controller detects that user is not logged:

public function before() {
    parent::before();

    if (!Auth::instance()->logged_in()) {
            HTTP::redirect('/User/login');
    }
}

Even if I use redirect to homepage I am still not logged in. It looks like session data is lost. Strange is that it was working for a long time and suddenly a day ago it stopped.

Many thanks for any advices!

  • 写回答

1条回答 默认 最新

  • dongwa3808 2019-07-18 07:39
    关注

    For future generations... I have changed session_type from native to cookie and log in is working. Why? I don't have a good answear.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向