seoco's avatar
Level 2

Rename password field name

Hi, Using laravel 5.2., Eloquent and authcontroller. Is there a way to rename the password field of the users table? I managed already to rename the table name, id and email but the rename of the password field is not working. We are planning to migrate one of our apps into Laravel and would like to reuse our table field names because some other frontend apps are also using this table.

thx

0 likes
4 replies
simondavies's avatar

where you say 'managed already to rename the table name, id and email but the rename of the password field is not ..' where have you tried to change it, within the db directly, in the Migration file?

As there are probably other sections to update like the Auth classes, as there are the validators etc.

seoco's avatar
Level 2

To rename the table and Id I added the following to the user.php file protected $table = 'D_USERS'; protected $primaryKey = 'USR_TK';

To rename the email address I adde this function to the authcontroller: public function loginUsername() { return property_exists($this, 'username') ? $this->username : 'USR_EMAIL'; }

I also change the email in the create and validate function

But for the password I can't figure it out

bestmomo's avatar

The password name is hard coded in EloquentUserProvider.

Snapey's avatar

The password field probably won't be much use to your legacy stuff unless they can use the same bcrypt hash technique and same salt

1 like

Please or to participate in this conversation.