mercredi 22 août 2018

Using laravel default auth, can register but can't relogin

so, i get this very weird situation, i am using laravel 5.6 fresh install 2 days ago. and i run php artisan make:auth and then migrate everything... then for a couple of day i creating my admin page and then i get into the part to do auth/login.

then i create my own register and login features

public function store(Request $request)
{
  $input = $request->all(); 
  $input['password'] = bcrypt($input['password']); 
  $user = User::create($input); 

  return Redirect::route('admins.users.index');
}

and login feature

public function login(Request $request)
{
    $credentials = $request->only('email', 'password');

    if (Auth::attempt($credentials)) {
        // Authentication passed...
        return redirect()->intended('admins');
    }

    return Redirect::route('admins.login');
}

and i doing register from there. after that i login but not working!

so i go to the default route "/" and click register, inserting email, pass, etc and after that it said i am logged in. And then i do logout, and here is the weird part, i tried to login using the same credential from register before and it gives me wrong "This identity does not match our data"

and then i tried to run tinker and doing

Auth::attempt(['email' => 'tony762843@yahoo.co.id', 'password' => 'solusi']);

and it returned false. and then i think i maybe messed up my laravel project, so i create a new project laravel and test out the register and login from laravel make::auth... everything works and then i slowly copying my code from the first project to this new one and then tried out again the my register and then using that credential to login and then it works

i don't know why, and my guest is the first user need to created from laravel make:auth... so i do artisan migrate::fresh to clean out the entire table on my first laravel project and then do register from default make:auth and then the login is working.... and also my register and my login is also working...

so for the time i think the laravel need to use the first record of user is from registering from laravel make:auth...

but 2 day passing and now i am in the middle of development, just after adding delete with ajax features it suddenly make all my login return false... i don't get it...

what is wrong with laravel?

my environment is using macos with valet secure (so https)



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2o7ealD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire