HttpBasicAuth::className(), 'auth' => [$this, 'auth'] ]; return $behaviors; } public function auth($username, $password) { try { // $query = Card::find(); // Card::addCardNumberCondition($query, Helper::fixAsciiChars($username)); // $card = $query->one(); $customer = Customer::findOne(['email' => $username]); if (isset($customer)) { if ($customer->validatePassword($password)) { return $customer; } } } catch (\Exception $e) { \Yii::error("Failed to load user: " . $e->getMessage()); } return null; } }