Hi I've searched through previous questions but none seem to answer my problem. I need to have my own loginController so I'm using Auth::attempt but it fails every time.
I've tested back through the laravel framework and it seems in the Illuminate\Hashing\BcryptHasher class my password is failing on the check function. I've checked it against what's in my database and it is giving a different hash for some reason.
I create my users like this:
public function insert()
{
$input = $this->request->input();
$input['password'] = Hash::make($input['password']);
$this->garage->insert($input);
return redirect('garage-admin/garage/view-garages');
}
So my passwords are hashed already. (I've tried using bcrypt instead of Hash::make but no difference).
I then have a loginController
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
class LoginController extends Controller
{
protected $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function login()
{
$login_status = false;
return view('auth.login',compact('login_status'));
}
public function attemptLogin()
{
$input = $this->request->input();
if(Auth::attempt(['username' => $input['username'], 'password' => $input['password']]))
{
$login_status = 'logged in';
}
else
{
$login_status = 'logged in failed';
}
return view('auth.login', compact('login_status'));
}
public function username()
{
return 'username';
}
}
but I just can't get it to pass the Auth::attempt. It's obviously trying as I can debug back to the password so it must be the hashing somewhere. I just can't figure it out.
Any help would be great - thanks