im continuing someone else's code. and have been trying to solve it for days.
its a running system using laravel. then i move the system to another computer.
i manage to set it up using xampp following this guide but after i logged in, it kept giving me invalid login. ive check the database, the credentials is there and its correct.
i really do not how to trace where it went wrong, but i manage to get this trace ( i change the db name); the password went missing.
Name of the error
PDOException in PDOConnection.php line 43:
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database
'myapp'
the error is due to i change the db username. ;) im trying to figure out why it did not work when i moved it to another machine. if the hashed password is hidden in the trace, me guess the trace ive shared will do no help. any ideas what i should do next? :_I
Update LoginController
Update As requested LoginController.php
<?php
namespace App\Http\Controllers\Frontend\MemberAuth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
use Hesto\MultiAuth\Traits\LogsoutGuard;
use Illuminate\Http\Request;
use App\Model\Member\Member;
use Response;
use App\Exceptions\Handler;
use App;
use App\Traits\ValidateCaptchaTrait;
use Lang;
use Carbon\Carbon;
class LoginController extends Controller
{
use AuthenticatesUsers, LogsoutGuard {
LogsoutGuard::logout insteadof AuthenticatesUsers;
}
use ValidateCaptchaTrait;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->redirectTo = route('frontend.memberprofile.account');
$this->middleware('member.guest', ['except' => 'logout']);
}
/**
* Override the username method used to validate login
*
* @return string
*/
public function username()
{
return 'agent_id';
}
/**
* Show the application's login form.
*
* @return \Illuminate\Http\Response
*/
public function showLoginForm()
{
return view('frontend.member.auth.login');
}
/**
* Get the guard to be used during authentication.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Auth::guard('member');
}
public function login(Request $request)
{
// Validate Captcha
if(!$this->isValidCaptcha()){
return redirect()->back()->withErrors(['captcha' => 'Invalid Captcha.'])->withInput();
}
$this->validateLogin($request);
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
if ($this->attemptLogin($request)) {
return $this->sendLoginResponse($request);
}
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
protected function credentials(Request $request)
{
// return $request->only($this->username(), 'password') ;
return array_merge($request->only($this->username(), 'password'), ['active' => 1]);
}
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
//
if(!is_null( $user )){
$user->lastlogin = Carbon::now();
$user->save();
}
return redirect()->intended($this->redirectPath());
}
}
update 2
<form class="form-horizontal" role="form" method="POST" action="{{ route('mem.lPost') }}"> {{ csrf_field(=) }}