Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with username login #248

Open
william1888 opened this issue Apr 21, 2017 · 12 comments
Open

Problem with username login #248

william1888 opened this issue Apr 21, 2017 · 12 comments
Assignees
Labels

Comments

@william1888
Copy link

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.

@acacha acacha self-assigned this Apr 21, 2017
@acacha acacha added the bug label Apr 21, 2017
@acacha
Copy link
Collaborator

acacha commented Apr 21, 2017

Confirmed same error here. Working on a solution!

@aibkenyeung
Copy link

the bug fixed?
I also have this issue.

@minhphuc429
Copy link
Contributor

me too

@dbrw
Copy link

dbrw commented Jul 19, 2017

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.

@jlobaton
Copy link

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

@AmruthPillai
Copy link
Contributor

Has anyone found a workaround to this?

@KhogaEslam
Copy link
Contributor

KhogaEslam commented Nov 1, 2017

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

@dbrw
Copy link

dbrw commented Nov 17, 2017

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

@ImCreator2
Copy link

ImCreator2 commented Dec 11, 2017

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.

@acacha
Copy link
Collaborator

acacha commented Mar 14, 2018

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

@acacha
Copy link
Collaborator

acacha commented Mar 14, 2018

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

php artisan adminlte:username

but this command requires interaction!

@acacha
Copy link
Collaborator

acacha commented Mar 14, 2018

See also #252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants