This commit is contained in:
J. Nick Koston 2025-07-11 10:11:26 -10:00
parent bb153d42dc
commit 7107b5cfef
No known key found for this signature in database
3 changed files with 4 additions and 11 deletions

View File

@ -1452,14 +1452,10 @@ HelloResponse APIConnection::hello(const HelloRequest &msg) {
resp.name = App.get_name();
#ifdef USE_API_PASSWORD
if (!this->parent_->uses_password()) {
// Auto-authenticate if no password is required
this->complete_authentication_();
} else {
this->flags_.connection_state = static_cast<uint8_t>(ConnectionState::CONNECTED);
}
// Password required - wait for authentication
this->flags_.connection_state = static_cast<uint8_t>(ConnectionState::CONNECTED);
#else
// No password support - always auto-authenticate
// No password configured - auto-authenticate
this->complete_authentication_();
#endif
@ -1483,7 +1479,7 @@ ConnectResponse APIConnection::connect(const ConnectRequest &msg) {
DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {
DeviceInfoResponse resp{};
#ifdef USE_API_PASSWORD
resp.uses_password = this->parent_->uses_password();
resp.uses_password = true;
#else
resp.uses_password = false;
#endif

View File

@ -227,8 +227,6 @@ void APIServer::dump_config() {
}
#ifdef USE_API_PASSWORD
bool APIServer::uses_password() const { return !this->password_.empty(); }
bool APIServer::check_password(const std::string &password) const {
// depend only on input password length
const char *a = this->password_.c_str();

View File

@ -42,7 +42,6 @@ class APIServer : public Component, public Controller {
bool teardown() override;
#ifdef USE_API_PASSWORD
bool check_password(const std::string &password) const;
bool uses_password() const;
void set_password(const std::string &password);
#endif
void set_port(uint16_t port);