stephb9959
2023-02-21 12:23:18 -08:00
parent daa264c984
commit 41ec3b3495
163 changed files with 19042 additions and 18764 deletions

View File

@@ -9,30 +9,31 @@
namespace OpenWifi {
void RESTAPI_subtotp_handler::DoGet() {
void RESTAPI_subtotp_handler::DoGet() {
auto Reset = GetBoolParameter("reset",false);
std::string QRCode;
auto Reset = GetBoolParameter("reset", false);
std::string QRCode;
if(TotpCache()->StartValidation(UserInfo_.userinfo,true,QRCode,Reset)) {
return SendFileContent(QRCode, "image/svg+xml","qrcode.svg");
}
return BadRequest(RESTAPI::Errors::InvalidCommand);
}
if (TotpCache()->StartValidation(UserInfo_.userinfo, true, QRCode, Reset)) {
return SendFileContent(QRCode, "image/svg+xml", "qrcode.svg");
}
return BadRequest(RESTAPI::Errors::InvalidCommand);
}
void RESTAPI_subtotp_handler::DoPut() {
auto Value = GetParameter("value","");
auto nextIndex = GetParameter("index",0);
bool moreCodes=false;
void RESTAPI_subtotp_handler::DoPut() {
auto Value = GetParameter("value", "");
auto nextIndex = GetParameter("index", 0);
bool moreCodes = false;
RESTAPI::Errors::msg Error;
if(TotpCache()->ContinueValidation(UserInfo_.userinfo,true,Value,nextIndex,moreCodes, Error )) {
Poco::JSON::Object Answer;
Answer.set("nextIndex", nextIndex);
Answer.set("moreCodes", moreCodes);
return ReturnObject(Answer);
}
return BadRequest(Error);
}
RESTAPI::Errors::msg Error;
if (TotpCache()->ContinueValidation(UserInfo_.userinfo, true, Value, nextIndex, moreCodes,
Error)) {
Poco::JSON::Object Answer;
Answer.set("nextIndex", nextIndex);
Answer.set("moreCodes", moreCodes);
return ReturnObject(Answer);
}
return BadRequest(Error);
}
}
} // namespace OpenWifi