【问题标题】:laracasts tutorial authentication failslaracasts 教程认证失败
【发布时间】:2015-08-15 20:06:51
【问题描述】:

我尝试运行下面的代码,发现“用户密码存储不正常”。我尝试删除数据库中的所有条目,但问题仍然存在。这是代码:

 $user = new User;
 $user->fname = 'joe';
 $user->lname = 'joe';
 $user->email = 'joe@gmail.com';
 $user->password = Hash::make('123456');
 if ( ! ($user->save()))
 {
     dd('user is not being saved to database properly - this is the problem');          
 }

 if ( ! (Hash::check('123456', Hash::make('123456'))))
 {
     dd('hashing of password is not working correctly - this is the problem');          
 }

 if ( ! (Auth::attempt(array('email' => 'joe@gmail.com', 'password' => '123456'))))
 {
     dd('storage of user password is not working correctly - this is the problem');          
 }

 else
 {
     dd('everything is working when the correct data is supplied - so the problem is related to your forms and the data being passed to the function');
 }

这个问题的原因可能是什么?我正在尝试进行登录身份验证。

【问题讨论】:

    标签: php authentication laravel-4 passwords


    【解决方案1】:

    哦,这只是一个愚蠢的错误,我确实尝试将数据库上密码和用户名字段的长度/值从 50 更改为 255。然后删除数据库的所有记录。这样做之后,我的登录身份验证现在正在工作。

    【讨论】:

      猜你喜欢
      • 2020-08-28
      • 2018-12-26
      • 2018-02-25
      • 2016-03-01
      • 2021-03-07
      • 2019-09-03
      • 2016-05-30
      • 2014-07-19
      • 2015-10-17
      相关资源
      最近更新 更多