Esempio n. 1
0
 /**
  * Generates password hash and security tokens
  * @param bool $insert
  * @return bool
  * @throws \yii\base\Exception
  * @throws \yii\base\InvalidConfigException
  */
 public function beforeSave($insert)
 {
     $this->isNewRecord = $this->getIsNewRecord();
     if ($this->isNewRecord) {
         $this->password = Yii::$app->security->generatePasswordHash($this->password);
     }
     return parent::beforeSave($insert);
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function beforeSave($insert)
 {
     $this->isNewRecord = $this->getIsNewRecord();
     return parent::beforeSave($insert);
 }