示例#1
0
 public function auth($username, $password)
 {
     $user = \app\models\User2::findOne(['username' => $username, 'status' => 10]);
     if (!$user) {
         throw new UnauthorizedHttpException('You are requesting with invalid username or password.');
     }
     if ($user->validatePassword($password)) {
         return $user;
     } else {
         return null;
     }
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAuthor()
 {
     return $this->hasOne(User2::className(), ['id' => 'author_id']);
 }