weixin_33736649 2016-02-02 12:33 采纳率: 0%
浏览 38

在laravel 5中记住我

my remember me functionality is not correctly working, Can any one help me with this..............

my problem is " when the user is logged in using remember me a cookie is being created but when he logs out the cookie is destroyed... that means when he wants to login again he has to remember his user name and password"

my Controller.php

$remember   = (Input::has('remember')) ? true : false;
if (\Auth::attempt('frontendUsers', array('cardno'    => Input::get('cardno'),'password'  => Input::get('password')), $remember)) 
                { 
...........................
}

my ajax

$("#loginform").submit(function(){

        var cardno       = $("#cardno").val();
        var password     = $("#pass").val();
        var catagory_id  = $("#catagory_id").val();

        var remember     = $("input[name = 'remember']:checked").length;

        $.ajax({
                url: '{{ url("postlogin") }}',

                dataType: 'json',

                type: 'post',

                data: {cardno:cardno,password:password,catagory_id:catagory_id,remember:remember},

                success: function( data, textStatus, jQxhr ){
.................
}
error:function(data){

                },
            });
            return false;
});
  • 写回答

1条回答 默认 最新

  • H_MZ 2019-05-17 10:07
    关注
    $remember   = ($request->has('remember')) ? true : false;
    

    You should not call 'has' statically.

    Instead of

    Input::has()
    

    Let it be

    $request->has()
    
    评论

报告相同问题?

悬赏问题

  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Bug traq 数据包 大概什么价
  • ¥15 在anaconda上pytorch和paddle paddle下载报错
  • ¥25 自动填写QQ腾讯文档收集表