【发布时间】: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