Esempio n. 1
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($insert) {
             $this->id = \app\components\mytools::getCurrentID2();
             $this->auth_key = \Yii::$app->security->generateRandomKey();
             $this->access_token = \Yii::$app->security->generateRandomString();
         }
         $this->password = \app\components\mytools::getMySQLPassword($this->password);
         $this->userlog = Yii::$app->user->id;
         $this->datetimelog = \app\components\mytools::getDateTime();
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 /**
  * Validates password
  *
  * @param  string  $password password to validate
  * @return boolean if password provided is valid for current user
  */
 public function validatePassword($password)
 {
     $encpassword = \app\components\mytools::getMySQLPassword($password);
     return $this->password === $encpassword;
 }