Laravel5.0: the logon password field is not customized by password or signature.

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.