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 jetson nano
  • ¥15 :app:debugCompileClasspath'.
  • ¥15 windows c++内嵌qt出现数据转换问题。
  • ¥20 公众号如何实现点击超链接后自动发送文字
  • ¥15 用php隐藏类名和增加类名
  • ¥15 算法设计与分析课程的提问
  • ¥15 用MATLAB汇总拟合图
  • ¥15 智能除草机器人方案设计
  • ¥15 对接wps协作接口实现消息发送
  • ¥15 SQLite 出现“Database is locked” 如何解决?