public function beforeAction($action) { if (!parent::beforeAction($action)) { return false; } $this->checkThatUserHasWallet(); return true; }
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; } }]]); }