php - Laravel: How can i change the default Auth Password field name -
i'm working on first laravel project , i'm facing problem.
if have experience laravel know calling php artisan make:auth
predefined mechanism handles login , registration.
this mechanism set understand couple of commonly used words in order automate whole procedure.
the problem occurs in case i'm using oracle db , won't let me have table column name of password
because system keyword , throws errors when trying insert user.
so far, i've tried change password
column passwd
, worked in registration form expected. user row inserted , page redirected /home.
but when try logout , relogin, error telling me credentials not correct.
as code, i've changed registercontroller.php
takes username instead of email
protected function validator(array $data) { return validator::make($data, [ 'username' => 'required|max:50|unique:econ_users', 'passwd' => 'required|min:6|confirmed', ]); } protected function create(array $data) { return user::create([ 'username' => $data['username'], 'passwd' => bcrypt($data['passwd']) ]); }
the user $fillable
protected $fillable = [ 'username', 'passwd' ];
i'm guessing auth trying authenticate email
, not username
or auth searching password
, not passwd
for having username
instead of email
, can overwrite username() in logincontroller.php
/** * login username used controller. * * @return string */ public function username() { return 'username'; }
and passwd
instead of password
, can define accessor in app\user.php
/** * password user. * * @return string */ public function getauthpassword() { return $this->passwd; }
login.blade.php : replace email
input username
do not change name of input password
.
Comments
Post a Comment