mirror of
https://github.com/esphome/esphome.git
synced 2025-07-30 15:16:37 +00:00
Merge branch 'missing_password_ifdefs' into integration
This commit is contained in:
commit
5f9bd75954
@ -1578,10 +1578,12 @@ bool APIConnection::send_buffer(ProtoWriteBuffer buffer, uint8_t message_type) {
|
|||||||
// Do not set last_traffic_ on send
|
// Do not set last_traffic_ on send
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_API_PASSWORD
|
||||||
void APIConnection::on_unauthenticated_access() {
|
void APIConnection::on_unauthenticated_access() {
|
||||||
this->on_fatal_error();
|
this->on_fatal_error();
|
||||||
ESP_LOGD(TAG, "%s access without authentication", this->get_client_combined_info().c_str());
|
ESP_LOGD(TAG, "%s access without authentication", this->get_client_combined_info().c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
void APIConnection::on_no_setup_connection() {
|
void APIConnection::on_no_setup_connection() {
|
||||||
this->on_fatal_error();
|
this->on_fatal_error();
|
||||||
ESP_LOGD(TAG, "%s access without full connection", this->get_client_combined_info().c_str());
|
ESP_LOGD(TAG, "%s access without full connection", this->get_client_combined_info().c_str());
|
||||||
|
@ -232,7 +232,9 @@ class APIConnection : public APIServerConnection {
|
|||||||
}
|
}
|
||||||
uint8_t get_log_subscription_level() const { return this->flags_.log_subscription; }
|
uint8_t get_log_subscription_level() const { return this->flags_.log_subscription; }
|
||||||
void on_fatal_error() override;
|
void on_fatal_error() override;
|
||||||
|
#ifdef USE_API_PASSWORD
|
||||||
void on_unauthenticated_access() override;
|
void on_unauthenticated_access() override;
|
||||||
|
#endif
|
||||||
void on_no_setup_connection() override;
|
void on_no_setup_connection() override;
|
||||||
ProtoWriteBuffer create_buffer(uint32_t reserve_size) override {
|
ProtoWriteBuffer create_buffer(uint32_t reserve_size) override {
|
||||||
// FIXME: ensure no recursive writes can happen
|
// FIXME: ensure no recursive writes can happen
|
||||||
|
@ -859,7 +859,9 @@ class ProtoService {
|
|||||||
virtual bool is_authenticated() = 0;
|
virtual bool is_authenticated() = 0;
|
||||||
virtual bool is_connection_setup() = 0;
|
virtual bool is_connection_setup() = 0;
|
||||||
virtual void on_fatal_error() = 0;
|
virtual void on_fatal_error() = 0;
|
||||||
|
#ifdef USE_API_PASSWORD
|
||||||
virtual void on_unauthenticated_access() = 0;
|
virtual void on_unauthenticated_access() = 0;
|
||||||
|
#endif
|
||||||
virtual void on_no_setup_connection() = 0;
|
virtual void on_no_setup_connection() = 0;
|
||||||
/**
|
/**
|
||||||
* Create a buffer with a reserved size.
|
* Create a buffer with a reserved size.
|
||||||
@ -900,10 +902,12 @@ class ProtoService {
|
|||||||
if (!this->check_connection_setup_()) {
|
if (!this->check_connection_setup_()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_API_PASSWORD
|
||||||
if (!this->is_authenticated()) {
|
if (!this->is_authenticated()) {
|
||||||
this->on_unauthenticated_access();
|
this->on_unauthenticated_access();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user