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()
    
    评论

报告相同问题?