It took a long time to fully understand how laravel5.0 implemented logon. For example, if the password field in the database is pwd instead of the default password, the modified files include: {code ...} if the signing method is different, the modified files are :... it took a long time to fully understand how laravel5.0 implemented logon.
For example, if the password field in the database is pwd instead of the default password, the modified files include:
// \ Vendor \ laravel \ framework \ src \ Illuminate \ Auth \ Authenticatable. phppublic function getAuthPassword () {// return $ this-> password; change to return $ this-> pwd ;}
If the signing method is different, the modified files include:
// \ Vendor \ laravel \ framework \ src \ Illuminate \ Auth \ EloquentUserProvider. phppublic function validateCredentials (UserContract $ user, array $ credentials) {$ plain = $ credentials ['Password']; // The following $ this-> hasher-> check is changed to custom signature strings equal to return $ this-> hasher-> check ($ plain, $ user-> getAuthPassword ());}
This modification is equivalent to modifying the source code of laravel, which is not elegant at all. Is there any better way?
Reply content:
It took a long time to fully understand how laravel5.0 implemented logon.
For example, if the password field in the database is pwd instead of the default password, the modified files include:
// \ Vendor \ laravel \ framework \ src \ Illuminate \ Auth \ Authenticatable. phppublic function getAuthPassword () {// return $ this-> password; change to return $ this-> pwd ;}
If the signing method is different, the modified files include:
// \ Vendor \ laravel \ framework \ src \ Illuminate \ Auth \ EloquentUserProvider. phppublic function validateCredentials (UserContract $ user, array $ credentials) {$ plain = $ credentials ['Password']; // The following $ this-> hasher-> check is changed to custom signature strings equal to return $ this-> hasher-> check ($ plain, $ user-> getAuthPassword ());}
This modification is equivalent to modifying the source code of laravel, which is not elegant at all. Is there any better way?
You can also implement login registration by yourself. However, I think the built-in functions are very useful.
If you add a field to the user table to obtain the field value, you canAuth ()-> user ()-> your field name