Maison > Questions et réponses > le corps du texte
现在的问题是这样的:
顺便问一下,yii2自带的验证密码的,加密方式是什么?可以做修改吗?
大家讲道理2017-04-10 15:23:12
...那个login
本来就不在common\model\User.php
里,另外Yii::$app->user
里的这个user
也不是common\model\User.php
,而是yii\web\User
,那么login
也就找到了;
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();
}