Php 使用电话号码laravel重置密码
我收到此错误Php 使用电话号码laravel重置密码,php,laravel,laravel-5,Php,Laravel,Laravel 5,我收到此错误此路由不支持GET方法。支持的方法:在令牌无效的情况下,当我尝试将用户重定向回时发布。我如何解决这个问题 放弃密码控制器 public function showPasswordResetForm(Request $request,$token) { $inputToken = $request->token; $tokenData = DB::table('password_resets') ->where('token', $token)-
此路由不支持GET方法。支持的方法:在令牌无效的情况下,当我尝试将用户重定向回时发布
。我如何解决这个问题
放弃密码控制器
public function showPasswordResetForm(Request $request,$token)
{
$inputToken = $request->token;
$tokenData = DB::table('password_resets')
->where('token', $token)->first();
$token = $tokenData->token;
if ($inputToken != $token) return redirect()->back()-
>withErrors(['token' => 'Token doesnt exist']); //redirect
back if the token does not exist.
return view('auth.passwords.reset')->with('token', $token);
}
刀片
在表单中,指定POST方法,而不是GET方法
在表单中的
中,指定POST方法,而不是GET方法
从什么是php artisan route:list
返回重置密码?我创建了自己的重置密码,因此有密码重置返回Auth\ForgotPasswordController@sendPasswordResetToken
@phperPHP artisan route:list
返回重置密码是什么?我已经创建了自己的重置密码因此,密码重置返回Auth\ForgotPasswordController@sendPasswordResetToken
@PHPerI have change GET to POST仍然不起作用,抛出相同的错误@PHPerI从函数变量中删除了$token。查看此行中$token未定义$tokenData=DB::table('password_resets')->where('token',$token)->first()代码>我在->where('token)…中重拨了check new code(我忘记将$token
重命名为$inputoken
)代码>仅当令牌为真时才起作用的控制器的一部分,如果它为假$token=$tokenData->token代码>抛出一个错误“尝试获取非对象的属性”
,因为它返回nullI have change get to POST仍然不起作用,抛出相同的错误@PHPerI从函数变量中删除了$token。查看此行中$token未定义$tokenData=DB::table('password_resets')->where('token',$token)->first()代码>我在->where('token)…中重拨了check new code(我忘记将$token
重命名为$inputoken
)代码>仅当令牌为真时才起作用的控制器的一部分,如果它为假$token=$tokenData->token代码>抛出一个错误“试图获取非对象的属性”
,因为它返回null
<div class="card-body">
<form method="GET" action="
{{route('check.token',$token) }}">
@csrf
<input id='token' type="text"class="formcontrol @error('token')
is-invalid @enderror" name="token" required
autocomplete="token"autofocus>
@error('token')
<span class="invalid-feedback"
role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
Route::get('reset-password/{token}',
'Auth\ForgotPasswordController@showPasswordResetForm')-
>name('check.token');
//Notice the removal of $token from function variables
public function showPasswordResetForm(Request $request)
{
$inputToken = $request->token;
$tokenData = DB::table('password_resets')
->where('token', $inputToken)->first();
$token = $tokenData->token;
if ($inputToken != $token) return redirect()->back()-
>withErrors(['token' => 'Token doesnt exist']); //redirect
back if the token does not exist.
return view('auth.passwords.reset')->with('token', $token);
}