Auto auth if no password is required

Next step in password deprecation
This commit is contained in:
J. Nick Koston 2025-07-11 09:22:40 -10:00
parent 0b74122d6f
commit 4dbe19a56e
No known key found for this signature in database

View File

@ -1467,7 +1467,13 @@ ConnectResponse APIConnection::connect(const ConnectRequest &msg) {
resp.invalid_password = !correct;
if (correct) {
ESP_LOGD(TAG, "%s connected", this->get_client_combined_info().c_str());
// Check if we're already authenticated (e.g., from auto-auth during hello)
bool was_authenticated = this->flags_.connection_state == static_cast<uint8_t>(ConnectionState::AUTHENTICATED);
this->flags_.connection_state = static_cast<uint8_t>(ConnectionState::AUTHENTICATED);
// Only trigger events if we weren't already authenticated
if (!was_authenticated) {
#ifdef USE_API_CLIENT_CONNECTED_TRIGGER
this->parent_->get_client_connected_trigger()->trigger(this->client_info_, this->client_peername_);
#endif
@ -1477,6 +1483,7 @@ ConnectResponse APIConnection::connect(const ConnectRequest &msg) {
}
#endif
}
}
return resp;
}
DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {