Search code examples
phplaraveljoomla

Laravel 5.6 login change Hash::make($data['password']) to


I have to use an old user database for our new Laravel 5.6 website. There is now way I can ask all the users to remake passwords. The old site was joomla 3.7.5 and after a bit of playing around I found that, check password on login Joomla 3.7.5 used...

$result = password_verify($PlanTextLoginForm, $PasswordForDB);

and to make a new user's password...

$PasswordForDB = password_hash($PlanTextLoginForm, PASSWORD_BCRYPT);

I have found about 6 places in Laravel to change...

Hash::make($data['password']) 
to
password_hash($data['password'], PASSWORD_BCRYPT);

I just can't find the login challenge?

nothing in the LoginController.

So the real question is where is the login-> function found for Auth::routes(); ?


Solution

  • Laravel basic authentication function

    public function postLogin()
    {
       $rules = array(
    'email'    => 'required|email', 
    'password' => 'required|alphaNum|min:6');
    
     $validator = Validator::make(Input::all(), $rules);
    
    if ($validator->fails()) 
    {
        return Redirect::to('login')
        ->withErrors($validator) 
        ->withInput(Input::except('password')); 
    } 
    else
    {
        $userdata = array(
        'email'     => Input::get('email'),
        'password'  => Input::get('password')
        );
       if (Auth::attempt($userdata)) 
       {
    
        return Redirect::to('dashboard');
    
        } 
        else
       {        
         return Redirect::to('login');
       }
    
      }
     }