首個解決方案:https://laravel.com/docs/5.4/authentication#authenticating-users
二解決方案:
1:就在LoginController.php
public function authenticate()
{
if (Auth::attempt(['email' => $email, 'password' => $password])) {
// Authentication passed...
return redirect()->intended('dashboard');
} else if(Auth::attempt(['email' => $email, 'password' => $old_password]) {
return redirect()->intended('dashboard');
}
}
檢查覆蓋public function authenticate()
運行php artisan event:generate
產生laravel事件。
2:運行php artisan make:event CheckOldPassword
3:添加事件在EventServiceProvider.php 'Illuminate\Auth\Events\Failed' => ['App\Listeners\CheckOldPassword'],
4:創建功能public function handle(Failed $event){}
5:手動檢查登錄事件。