1
laravelでカスタムチェックを作成しようとしています。私はLoginController
ログインしようとするとLaravel 5.5エラーが発生する
public function customchecker()
{
$credentials = [
'username' => Input::get('username'),
'password' => Input::get('password')
];
if (Auth::attempt($credentials)) {
return Redirect::to('account')->with('alert-success', 'You are now logged in.');
$errors = new MessageBag(['password' => ['Email and/or password invalid.']]);
return Redirect::back()->withErrors($errors)->withInput(Input::except('password'));
}
}
でこれを追加し、ここに私のルートは
Route::get('/', function() {
return view('welcome');
});
Auth::routes();
Route::get('/home', '[email protected]')->name('home');
Route::get('customchecker','[email protected]')->name('customchecker');
ですが、私はエラーを取得し、ここで私の誤差が MethodNotAllowedHttpException \
のSymfony \コンポーネント\ HttpKernel \例外です メッセージなし
だから、どうすれば修正できますか?
条件を確認してください。 Auth :: attempt($ credentials)がtrueの場合、リダイレクトは2回実行されます。問題を引き起こす可能性があります! –
あなたは普通のパスワードも返しているようです。これをbcrypt()を使って暗号化していませんか? – Option