【发布时间】:2014-08-27 16:57:45
【问题描述】:
我的 Laravel 身份验证运行良好。我包括密码更改功能。更改密码后,除了第一个用户(uid =“1”)之外的所有用户都可以正常登录。只有默认密码哈希适用于此用户。对于其他密码哈希,登录尝试失败。我的代码如下:
用户控制器登录
public function postSignin() {
if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) {
return Redirect::to('users/dashboard')->with(array('message' => 'You are now logged in!', 'email' => Input::get('email')));
} else {
return Redirect::to('users/login')
->with('message', 'Your username/password combination was incorrect')
->withInput();
}
}
表架构
Schema::create('users', function($table)
{
$table->increments('id');
$table->string('firstname', 20);
$table->string('lastname', 20);
$table->string('email', 100)->unique();
$table->string('password', 255);
$table->string('remember_token', 255);
$table->timestamps();
});
密码更改控制器功能
public function postUpass() {
$user = User::find(Input::get('uid'));
if((Input::get('password'))==(Input::get('passconf'))){
$user->password = Hash::make(trim(Input::get('password')));
$user->save();
echo "Done";
//echo Hash::make(trim(Input::get('password')));
}
else {
echo "Check Passwords Again";
}
请有人帮我解决这个问题。
【问题讨论】:
标签: php authentication laravel laravel-4