Files
wlan-cloud-ucentralgw/src/AP_WS_Process_deviceupdate.cpp
2023-11-27 13:05:52 -08:00

31 lines
785 B
C++

//
// Created by stephane bourque on 2022-07-26.
//
#include "AP_WS_Connection.h"
#include "StorageService.h"
#include "fmt/format.h"
namespace OpenWifi {
void AP_WS_Connection::Process_deviceupdate(Poco::JSON::Object::Ptr ParamsObj,
std::string &Serial) {
if (!State_.Connected) {
poco_warning(Logger_,
fmt::format("INVALID-PROTOCOL({}): Device '{}' is not following protocol",
CId_, CN_));
Errors_++;
return;
}
if (ParamsObj->has("currentPassword")) {
auto Password = ParamsObj->get("currentPassword").toString();
StorageService()->SetDevicePassword(*DbSession_,Serial, Password);
poco_trace(
Logger_,
fmt::format("DEVICE-UPDATE({}): Device is updating its login password.", Serial));
}
}
} // namespace OpenWifi