adminlte-laravel
adminlte-laravel copied to clipboard
Problem with username login
When logging with username it will say "These credentials do not match our records.". But when I refresh the page I will be logged in.
Confirmed same error here. Working on a solution!
the bug fixed? I also have this issue.
me too
dear @acacha woud like to thank you for this great package. about this issue, have you found the problem? maybe you can share the tweak so we can apply it too.
I have the same problem, after submitting the login, the error.. These credentials do not match our records.
Has anyone found a workaround to this?
Any updates ??? I have the same problem, although he logs in and when I refresh login page it redirects to home/dashboard page !
Hi, all. I've got a workaround for this.
You have to edit app/Http/Controllers/Auth/LoginController
, then change all the code on attemptLogin(Request $request)
function on line 73 into:
protected function attemptLogin(Request $request)
{
return $this->attemptLoginAtAuthenticatesUsers($request);
}
Thanks @dbrw for the hint.. I've made the following changes to
app/Http/Controllers/Auth/LoginController
to get it work on my project.
protected function attemptLogin(Request $request)
{
if ($this->username() === 'email') return $this->attemptLoginAtAuthenticatesUsers($request);
if ( ! $this->attemptLoginAtAuthenticatesUsers($request)) {
return $this->attempLoginUsingUsernameAsAnEmail($request);
}
return false;
}
Changed to ->
protected function attemptLogin(Request $request)
{
if ($this->username() === 'email')
return $this->attemptLoginAtAuthenticatesUsers($request);
else
return $this->attempLoginUsingUsernameAsAnEmail($request);
}
And If you're having separate column for username, & passing username only. then change,
protected function attempLoginUsingUsernameAsAnEmail(Request $request)
{
return $this->guard()->attempt(
['email' => $request->input('username'), 'password' => $request->input('password')],
$request->has('remember'));
}
Changed 'email' to -> 'username'
protected function attempLoginUsingUsernameAsAnEmail(Request $request)
{
return $this->guard()->attempt(
['username' => $request->input('username'), 'password' => $request->input('password')],
$request->has('remember'));
}
And it's working for me now.
Sorry I'm so busy... asap I will take a look at that!
This tests could no be executed always only after correctly executing:
php artisan adminlte:username
but this command requires interaction!
See also https://github.com/acacha/adminlte-laravel/issues/252