mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 00:58:40 +00:00
[demo] Fix alarm control panel auth bypass when code is omitted (#14645)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
9902447834
commit
470d9160a5
@@ -32,8 +32,8 @@ class DemoAlarmControlPanel : public AlarmControlPanel, public Component {
|
||||
auto code = call.get_code();
|
||||
switch (state) {
|
||||
case ACP_STATE_ARMED_AWAY:
|
||||
if (this->get_requires_code_to_arm() && code.has_value()) {
|
||||
if (*code != "1234") {
|
||||
if (this->get_requires_code_to_arm()) {
|
||||
if (!code.has_value() || *code != "1234") {
|
||||
this->status_momentary_error("invalid_code", 5000);
|
||||
return;
|
||||
}
|
||||
@@ -41,8 +41,8 @@ class DemoAlarmControlPanel : public AlarmControlPanel, public Component {
|
||||
this->publish_state(ACP_STATE_ARMED_AWAY);
|
||||
break;
|
||||
case ACP_STATE_DISARMED:
|
||||
if (this->get_requires_code() && code.has_value()) {
|
||||
if (*code != "1234") {
|
||||
if (this->get_requires_code()) {
|
||||
if (!code.has_value() || *code != "1234") {
|
||||
this->status_momentary_error("invalid_code", 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user