Thursday, March 9, 2017

Changing Laravel 5.4 password encryption and table column names

I am trying to integrate the auth in laravel 5.4 within an existing database where the user and password fields have other names (memberid, passwordnew_enc). With the bellow changes and forcing the create function in RegisterController to use md5 I managed to make the registration work. It also logins fine after registration. However the actual login form returns These credentials do not match our records.

So far I have changed the User.php

public function getAuthPassword()
{
    return $this->passwordnew_enc;
}

and

public function setPasswordAttribute($value)
{
    $this->attributes['password'] = md5($value);
}

Also on LoginController.php

public function username()
{
    return 'memberid';
}

Did I miss something ?

I only need to change the two column names to fit and the password encryption from bcrypt to md5



via dev

Advertisement