The login () method cannot be found in the User. php class of yii2 (in common/model/User. php ).

Source: Internet
Author: User
The question is: By the way, what is the encryption method for yii2's built-in authentication password? Can it be modified?

The problem is as follows:

By the way, what is the encryption method for the yii2 built-in verification password? Can it be modified?

Reply content:

The problem is as follows:

By the way, what is the encryption method for the yii2 built-in verification password? Can it be modified?

... ThatloginNot herecommon\model\User.phpAndYii::$app->userInuserNeithercommon\model\User.php,yii\web\User, ThenloginThis is what we found;

public function login(IdentityInterface $identity, $duration = 0)    {        if ($this->beforeLogin($identity, false, $duration)) {            $this->switchIdentity($identity, $duration);            $id = $identity->getId();            $ip = Yii::$app->getRequest()->getUserIP();            if ($this->enableSession) {                $log = "User '$id' logged in from $ip with duration $duration.";            } else {                $log = "User '$id' logged in from $ip. Session not enabled.";            }            Yii::info($log, __METHOD__);            $this->afterLogin($identity, false, $duration);        }        return !$this->getIsGuest();    }

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.