Framework update.

This commit is contained in:
stephb9959
2022-05-06 09:35:20 -07:00
parent 8076467b20
commit 5fbad76c83
13 changed files with 50 additions and 62 deletions

View File

@@ -76,7 +76,11 @@ namespace OpenWifi {
}
SecurityObjects::UserInfo NewUser;
RESTAPI_utils::from_request(NewUser,*Request);
const auto & RawObject = ParsedBody_;
if(!NewUser.from_json(RawObject)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
if(NewUser.userRole == SecurityObjects::UNKNOWN || NewUser.userRole != SecurityObjects::SUBSCRIBER) {
return BadRequest(RESTAPI::Errors::InvalidUserRole);
}
@@ -150,7 +154,6 @@ namespace OpenWifi {
}
if(GetBoolParameter("resetMFA")) {
DrainBody();
if( (UserInfo_.userinfo.userRole == SecurityObjects::ROOT) ||
(UserInfo_.userinfo.userRole == SecurityObjects::ADMIN && Existing.userRole!=SecurityObjects::ROOT) ||
(UserInfo_.userinfo.id == Id)) {
@@ -175,7 +178,6 @@ namespace OpenWifi {
}
if(GetBoolParameter("forgotPassword")) {
DrainBody();
Existing.changePassword = true;
Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", Request->clientAddress().toString(), Existing.email));
@@ -192,7 +194,7 @@ namespace OpenWifi {
}
SecurityObjects::UserInfo NewUser;
auto RawObject = ParseStream();
const auto & RawObject = ParsedBody_;
if(!NewUser.from_json(RawObject)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}