Laravel 4身份验证:提醒控制器 - 未找到GET重置

Set*_*eth 1 php authentication symfony laravel laravel-4

我在新的应用程序中使用Laravel 4的内置密码提醒功能.似乎它生成的代码和文档所说的是不完整的,不一致的,或者我错过了一个重要的观点.

到目前为止,我有......

  1. 创建的提醒表
  2. 迁移它
  3. 创建的提醒控制器
  4. password/remind成功地测试了get/post .

我卡住的地方是控制器的重置方法.提醒网址已成功发送到我的电子邮箱,一旦我点击它,我就会收到Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException错误消息.

Password::remind静态方法发送到我的电子邮件的URL 是http://localhost/application/public/password/reset/3e5e7a5c8562b28909b9948e848c5692dccb4f8a.

提醒控制器中的我的GET/POST重置方法 -

    public function getReset($token = null)
    {
        if (is_null($token)) App::abort(404);

        return View::make('password.reset')->with('token', $token);
    }

    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:
            case Password::INVALID_USER:
                return Redirect::back()->with('error', Lang::get($response));

            case Password::PASSWORD_RESET:
                return Redirect::to('/');
        }
    }
Run Code Online (Sandbox Code Playgroud)

我的密码/ reset.blade.php文件 -

{{ Form::open(array('url' => 'password/reset')) }}
  {{ Form::hidden('token', $token) }}
  {{ Form::email('email', null, array('class'=>'', 'placeholder'=>'Email Address')) }}
  {{ Form::password('password', array('class'=>'', 'placeholder'=>'Password')) }}
  {{ Form::password('password_confirmation', array('class'=>'', 'placeholder'=>'Password Confirmation')) }}

  {{ Form::submit('Reset Password', array('class'=>'')) }}
{{ Form::close() }}
Run Code Online (Sandbox Code Playgroud)

任何人都有任何关于我哪里出错的想法?

Kyl*_*ham 6

如果它们尚不存在,您最有可能遗漏一些路线.

Route::get('password/reset/{token}', 'RemindersController@getReset');

您也可能需要重置post路线.

Route::post('password/reset/{token}', 'RemindersController@postReset');