【发布时间】:2014-08-15 12:34:15
【问题描述】:
您好,密码提醒系统有一些奇怪的问题。此函数的返回始终是密码令牌不匹配。
这是记忆控制器
<?php
class RemindersController extends Controller {
/**
* Display the password reminder view.
*
* @return Response
*/
public function getRemind()
{
return View::make('resetacc');
}
/**
* Handle a POST request to remind a user of their password.
*
* @return Response
*/
public function postRemind()
{
switch ($response = Password::remind(Input::only('email')))
{
case Password::INVALID_USER:
return Redirect::back()->with('message', Lang::get($response));
case Password::REMINDER_SENT:
return Redirect::back()->with('message', Lang::get($response));
}
}
/**
* Display the password reset view for the given token.
*
* @param string $token
* @return Response
*/
public function getReset($token = null)
{
if (is_null($token)) App::abort(404);
return View::make('resetpass')->with('token', $token);
}
/**
* Handle a POST request to reset a user's password.
*
* @return Response
*/
public function postReset()
{
$credentials = Input::only(
'email', 'password', 'password_confirmation', 'token'
);
$response = Password::reset($credentials, function($user, $password)
{
$user->password = Hash::make($password);
$user->save();
});
switch ($response)
{
case Password::INVALID_PASSWORD:
case Password::INVALID_TOKEN:
return Redirect::to('/reset')->with('message', Lang::get($response));
case Password::INVALID_USER:
return Redirect::back()->with('message', Lang::get($response));
case Password::PASSWORD_RESET:
return Redirect::to('/auth')->with('message', 'Password Reset anda berhasil, silahkan login.');
}
}
}
和 Routes.php
Route::get('reset', function() {
return View::make('resetacc');
});
Route::get('password/reset/{token}', array(
'uses' => 'RemindersController@getReset',
'as' => 'resetpass'
));
存储在数据库中的令牌与给用户的令牌相同。
我有 laravel 4.1 版,然后更新到 4.2.5
是因为更新过程吗?
谢谢
【问题讨论】:
标签: php laravel token remember-me