我是laravel的新手,我正在尝试进行密码重置功能。 使用本指南(http://laravel.com/docs/5.1/authentication#resetting-passwords),我可以设置视图和电子邮件。
所以现在,我必须输入我的电子邮件,然后它通过电子邮件将我发送到带有令牌的链接(如此http://project.dev/password/reset/d500d7fb15f0dd12e079bb38c23baeba51a8849829d07aeff244ec80711ad015),然后我进入了我必须输入电子邮件和新密码的视图
以下是我的观点代码
@extends('layouts.master')
@section('title', 'New Password')
@section('content')
<div class="registrationform">
<div class="row "><div class="col-xs-6 col-xs-offset-3"><div class="panel panel-login">
<div class="panel-heading">
<div class="row">
<div class="col-xs-6">
<h4>New Password</h4>
</div>
</div>
<hr>
</div>
<div class="panel-body"><div class="row"><div class="col-lg-12">
<form id="loginform" action="" method="POST" role="form" style="display: block;">
<div class="form-group">
<input type="text" name="email" id="email" tabindex="1" class="form-control" placeholder="john@snow.com" value="">
</div>
<div class="form-group">
<input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="New Password">
</div>
<div class="form-group">
<input type="password" name="password_confirmation" id="password_confirmation" tabindex="5" class="form-control" placeholder="Confirm Password">
</div>
<div class="form-group">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
</div>
<div class="form-group">
<div class="row"><div class="col-sm-6 col-sm-offset-3">
<input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="confirm">
</div></div>
</div>
<div class="form-group"><div class="row"><div class="col-lg-12">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
当我填写表单时会出错
糟糕,看起来出了问题。
RouteCollection.php第219行中的1/1 MethodNotAllowedHttpException:
这是我收到的完整错误
in RouteCollection.php line 219
at RouteCollection->methodNotAllowed(array('GET', 'HEAD')) in RouteCollection.php line 206
at RouteCollection->getRouteForMethods(object(Request), array('GET', 'HEAD')) in RouteCollection.php line 158
at RouteCollection->match(object(Request)) in Router.php line 746
at Router->findRoute(object(Request)) in Router.php line 655
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
我一直在寻找解决方案已有一段时间了,但我还没有找到任何东西,我希望你们有一个可以帮助我。
答案 0 :(得分:2)
告诉你的错误是什么?
MethodNotAllowedException
表示不允许使用您检索该URL的方法(GET,POST等)。
如果您在加载页面时收到此信息,则不允许GET。如果您在提交表单时收到此信息,则不允许POST。
检查app/Http/routes.php
文件,确保password/reset/{token}
路由同时拥有GET和POST。