2016-12-06 129 views
2

我是Laravel的新手,我在使用4.2版本的系统上做了一些测试。我正试图按照Documentation重设密码。到目前为止,我可以发布我的电子邮件进行密码重置,并在我的电子邮件中获得令牌。带密码的密码重置laravel 4.2

当我从与令牌电子邮件打开URL我得到这个错误:

exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'

的网址是:http://example.com/reset/20e2535a11f7c88d1132c55c752a3a8569adbf5f

这是我的路线

Route::get('/password', ['uses' => '[email protected]']); 
Route::get('/reset', ['uses' => '[email protected]']); 

这是RemindersController

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

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

而且从文档的

<form action="{{ action('[email protected]') }}" method="POST"> 
    <input type="hidden" name="token" value="{{ $token }}"> 
    <input type="email" name="email"> 
    <input type="password" name="password"> 
    <input type="password" name="password_confirmation"> 
    <input type="submit" value="Reset Password"> 
</form> 

我理解错误..它是说,路径/文件中找不到但它的存在..如果

+0

这里看看http://stackoverflow.com/questions/29241969/reset-password-without-token-in-laravel-4-2 – Blueblazer172

+0

@ Blueblazer172我想用令牌.. – VLS

+0

然后看[这里](https://laracasts.com/discuss/channels/laravel/get-a -password-reset-token/answers/90648)或[here](htt p://stackoverflow.com/a/26362002/5930557) – Blueblazer172

回答

1
在HTML表单

,有action()方法称为[email protected]

<form action="{{ action('[email protected]') }}" method="POST"> 
    <input type="hidden" name="token" value="{{ $token }}"> 
    <input type="email" name="email"> 
    <input type="password" name="password"> 
    <input type="password" name="password_confirmation"> 
    <input type="submit" value="Reset Password"> 
</form> 

,但你的路由使用GET。你必须使用POST

路线从改变:

Route::get('/reset', ['uses' => '[email protected]']); 

到:

Route::post('/reset', ['uses' => '[email protected]']); 

我想你可以用这种方式。它也许更好:

Route::match(['GET','POST'], ['uses' => '[email protected]']); 



更新:路线也应该有它token因为URL是/reset/token

Route::get('/reset/{token}', ['uses' => '[email protected]']); 
+0

但是我的reset.blade在'/ site /'不在/'auth/' – VLS

+0

@VLS尝试将其更改为身份验证,然后再试一次 – Blueblazer172

+0

我只是为了测试..但我不想在那里。 – VLS

1

检查您的默认控制器或默认形式安全控制器不加载的地方,它不会不覆盖“复位”的路线,使用命令行和类型得到您的应用程序目录:

php artisan routes 

这应该告诉你,如果你的路线被注册到控制器/动作。

+0

我没有权限访问ssh终端并且无法运行命令 – VLS