/** @inheritdoc */
public function beforeSave($insert)
{
if (!$insert) {
if ($this->isAttributeChanged('Password')) {
$this->Password = $this->generatePasswordHash($this->Password);
}
}
return BaseActiveRecord::beforeSave($insert);
if ($insert) {
// $this->setAttribute('auth_key', \Yii::$app->security->generateRandomString());
// if (\Yii::$app instanceof \yii\web\Application) {
// $this->setAttribute('registration_ip', \Yii::$app->request->userIP);
// }
// if (!empty($this->Password)) {
// $this->setAttribute('password_hash', Password::hash($this->password));
// }
}
}