adminlte-laravel icon indicating copy to clipboard operation
adminlte-laravel copied to clipboard

Problem with username login

Open william1888 opened this issue 7 years ago • 12 comments

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.

william1888 avatar Apr 21 '17 02:04 william1888

Confirmed same error here. Working on a solution!

acacha avatar Apr 21 '17 11:04 acacha

the bug fixed? I also have this issue.

aibkenyeung avatar May 26 '17 02:05 aibkenyeung

me too

minhphuc429 avatar Jun 21 '17 15:06 minhphuc429

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.

dbrw avatar Jul 19 '17 02:07 dbrw

I have the same problem, after submitting the login, the error.. These credentials do not match our records.

jlobaton avatar Jul 23 '17 22:07 jlobaton

Has anyone found a workaround to this?

AmruthPillai avatar Oct 02 '17 06:10 AmruthPillai

Any updates ??? I have the same problem, although he logs in and when I refresh login page it redirects to home/dashboard page !

KhogaEslam avatar Nov 01 '17 15:11 KhogaEslam

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);
}

dbrw avatar Nov 17 '17 02:11 dbrw

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.

ImCreator2 avatar Dec 11 '17 10:12 ImCreator2

Sorry I'm so busy... asap I will take a look at that!

acacha avatar Mar 14 '18 15:03 acacha

This tests could no be executed always only after correctly executing:

php artisan adminlte:username

but this command requires interaction!

acacha avatar Mar 14 '18 16:03 acacha

See also https://github.com/acacha/adminlte-laravel/issues/252

acacha avatar Mar 14 '18 16:03 acacha