public function beforeAction($action)
 {
     if (!parent::beforeAction($action)) {
         return false;
     }
     $this->checkThatUserHasWallet();
     return true;
 }
示例#2
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['authenticator' => ['class' => HttpBasicAuth::className(), 'auth' => function ($username, $password) {
         $model = User::findOne(['username' => $username]);
         if ($model->validatePassword($password)) {
             return $model;
         }
     }]]);
 }