Changing SMS/MFA

This commit is contained in:
stephb9959
2022-05-06 08:47:23 -07:00
parent ce1764919f
commit 8076467b20
3 changed files with 12 additions and 13 deletions

View File

@@ -150,9 +150,7 @@ namespace OpenWifi {
}
if(GetBoolParameter("resetMFA")) {
if(Request->getContentLength()>0) {
std::ignore = ParseStream();
}
DrainBody();
if( (UserInfo_.userinfo.userRole == SecurityObjects::ROOT) ||
(UserInfo_.userinfo.userRole == SecurityObjects::ADMIN && Existing.userRole!=SecurityObjects::ROOT) ||
(UserInfo_.userinfo.id == Id)) {
@@ -177,9 +175,7 @@ namespace OpenWifi {
}
if(GetBoolParameter("forgotPassword")) {
if(Request->getContentLength()>0) {
std::ignore = ParseStream();
}
DrainBody();
Existing.changePassword = true;
Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", Request->clientAddress().toString(), Existing.email));

View File

@@ -149,6 +149,7 @@ namespace OpenWifi {
SecurityObjects::UserInfo Existing;
if(!StorageService()->UserDB().GetUserById(Id,Existing)) {
DrainBody();
return NotFound();
}
@@ -157,9 +158,7 @@ namespace OpenWifi {
}
if(GetBoolParameter("resetMFA")) {
if(Request->getContentLength()>0) {
std::ignore = ParseStream();
}
DrainBody();
if( (UserInfo_.userinfo.userRole == SecurityObjects::ROOT) ||
(UserInfo_.userinfo.userRole == SecurityObjects::ADMIN && Existing.userRole!=SecurityObjects::ROOT) ||
(UserInfo_.userinfo.id == Id)) {
@@ -184,9 +183,7 @@ namespace OpenWifi {
}
if(GetBoolParameter("forgotPassword")) {
if(Request->getContentLength()>0) {
std::ignore = ParseStream();
}
DrainBody();
Existing.changePassword = true;
Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", Request->clientAddress().toString(), Existing.email));
SecurityObjects::ActionLink NewLink;

View File

@@ -2011,6 +2011,12 @@ namespace OpenWifi {
return false;
}
void DrainBody() {
if (Request->getContentLength() > 0) {
std::ignore = ParseStream();
}
}
inline void SetCommonHeaders(bool CloseConnection=false) {
Response->setVersion(Poco::Net::HTTPMessage::HTTP_1_1);
Response->setChunkedTransferEncoding(true);