Framework update

This commit is contained in:
stephb9959
2022-05-05 23:15:58 -07:00
parent c36d9157c4
commit 60bd8fd2b2
3 changed files with 14 additions and 14 deletions

View File

@@ -113,7 +113,7 @@ namespace OpenWifi {
return SendHTMLFileBack(FormFile,FormVars); return SendHTMLFileBack(FormFile,FormVars);
} }
UInfo.modified = std::time(nullptr); UInfo.modified = OpenWifi::Now();
if(Link.userAction) if(Link.userAction)
StorageService()->UserDB().UpdateUserInfo(UInfo.email,Link.userId,UInfo); StorageService()->UserDB().UpdateUserInfo(UInfo.email,Link.userId,UInfo);
else else
@@ -184,9 +184,9 @@ namespace OpenWifi {
return SendHTMLFileBack(FormFile,FormVars); return SendHTMLFileBack(FormFile,FormVars);
} }
UInfo.modified = std::time(nullptr); UInfo.modified = OpenWifi::Now();
UInfo.changePassword = false; UInfo.changePassword = false;
UInfo.lastEmailCheck = std::time(nullptr); UInfo.lastEmailCheck = OpenWifi::Now();
UInfo.waitingForEmailCheck = false; UInfo.waitingForEmailCheck = false;
UInfo.validated = OpenWifi::Now(); UInfo.validated = OpenWifi::Now();
@@ -237,9 +237,9 @@ namespace OpenWifi {
Logger_.information(fmt::format("EMAIL-VERIFICATION(%s): For ID={}", Request->clientAddress().toString(), UInfo.email)); Logger_.information(fmt::format("EMAIL-VERIFICATION(%s): For ID={}", Request->clientAddress().toString(), UInfo.email));
UInfo.waitingForEmailCheck = false; UInfo.waitingForEmailCheck = false;
UInfo.validated = true; UInfo.validated = true;
UInfo.lastEmailCheck = std::time(nullptr); UInfo.lastEmailCheck = OpenWifi::Now();
UInfo.validationDate = std::time(nullptr); UInfo.validationDate = OpenWifi::Now();
UInfo.modified = std::time(nullptr); UInfo.modified = OpenWifi::Now();
if(Link.userAction) if(Link.userAction)
StorageService()->UserDB().UpdateUserInfo(UInfo.email, Link.userId, UInfo); StorageService()->UserDB().UpdateUserInfo(UInfo.email, Link.userId, UInfo);
else else

View File

@@ -76,7 +76,7 @@ namespace OpenWifi {
} }
} }
if(GetBoolParameter(RESTAPI::Protocol::REQUIREMENTS, false)) { if(GetBoolParameter(RESTAPI::Protocol::REQUIREMENTS)) {
Logger_.information(fmt::format("POLICY-REQUEST({}): Request.", Request->clientAddress().toString())); Logger_.information(fmt::format("POLICY-REQUEST({}): Request.", Request->clientAddress().toString()));
Poco::JSON::Object Answer; Poco::JSON::Object Answer;
Answer.set(RESTAPI::Protocol::PASSWORDPATTERN, AuthService()->PasswordValidationExpression()); Answer.set(RESTAPI::Protocol::PASSWORDPATTERN, AuthService()->PasswordValidationExpression());
@@ -85,7 +85,7 @@ namespace OpenWifi {
return ReturnObject(Answer); return ReturnObject(Answer);
} }
if(GetBoolParameter(RESTAPI::Protocol::FORGOTPASSWORD,false)) { if(GetBoolParameter(RESTAPI::Protocol::FORGOTPASSWORD)) {
SecurityObjects::UserInfo UInfo1; SecurityObjects::UserInfo UInfo1;
auto UserExists = StorageService()->UserDB().GetUserByEmail(userId,UInfo1); auto UserExists = StorageService()->UserDB().GetUserByEmail(userId,UInfo1);
if(UserExists) { if(UserExists) {
@@ -95,7 +95,7 @@ namespace OpenWifi {
NewLink.action = OpenWifi::SecurityObjects::LinkActions::FORGOT_PASSWORD; NewLink.action = OpenWifi::SecurityObjects::LinkActions::FORGOT_PASSWORD;
NewLink.id = MicroService::CreateUUID(); NewLink.id = MicroService::CreateUUID();
NewLink.userId = UInfo1.id; NewLink.userId = UInfo1.id;
NewLink.created = std::time(nullptr); NewLink.created = OpenWifi::Now();
NewLink.expires = NewLink.created + (24*60*60); NewLink.expires = NewLink.created + (24*60*60);
NewLink.userAction = true; NewLink.userAction = true;
StorageService()->ActionLinksDB().CreateAction(NewLink); StorageService()->ActionLinksDB().CreateAction(NewLink);
@@ -114,7 +114,7 @@ namespace OpenWifi {
} }
} }
if(GetBoolParameter(RESTAPI::Protocol::RESENDMFACODE,false)) { if(GetBoolParameter(RESTAPI::Protocol::RESENDMFACODE)) {
Logger_.information(fmt::format("RESEND-MFA-CODE({}): Request for {}", Request->clientAddress().toString(), userId)); Logger_.information(fmt::format("RESEND-MFA-CODE({}): Request for {}", Request->clientAddress().toString(), userId));
if(Obj->has("uuid")) { if(Obj->has("uuid")) {
auto uuid = Obj->get("uuid").toString(); auto uuid = Obj->get("uuid").toString();

View File

@@ -70,7 +70,7 @@ namespace OpenWifi {
} }
} }
if(GetBoolParameter(RESTAPI::Protocol::REQUIREMENTS, false)) { if(GetBoolParameter(RESTAPI::Protocol::REQUIREMENTS)) {
Logger_.information(fmt::format("POLICY-REQUEST({}): Request.", Request->clientAddress().toString())); Logger_.information(fmt::format("POLICY-REQUEST({}): Request.", Request->clientAddress().toString()));
Poco::JSON::Object Answer; Poco::JSON::Object Answer;
Answer.set(RESTAPI::Protocol::PASSWORDPATTERN, AuthService()->SubPasswordValidationExpression()); Answer.set(RESTAPI::Protocol::PASSWORDPATTERN, AuthService()->SubPasswordValidationExpression());
@@ -79,7 +79,7 @@ namespace OpenWifi {
return ReturnObject(Answer); return ReturnObject(Answer);
} }
if(GetBoolParameter(RESTAPI::Protocol::FORGOTPASSWORD,false)) { if(GetBoolParameter(RESTAPI::Protocol::FORGOTPASSWORD)) {
SecurityObjects::UserInfo UInfo1; SecurityObjects::UserInfo UInfo1;
auto UserExists = StorageService()->SubDB().GetUserByEmail(userId,UInfo1); auto UserExists = StorageService()->SubDB().GetUserByEmail(userId,UInfo1);
if(UserExists) { if(UserExists) {
@@ -108,7 +108,7 @@ namespace OpenWifi {
} }
} }
if(GetBoolParameter(RESTAPI::Protocol::RESENDMFACODE,false)) { if(GetBoolParameter(RESTAPI::Protocol::RESENDMFACODE)) {
Logger_.information(fmt::format("RESEND-MFA-CODE({}): Request for {}", Request->clientAddress().toString(), userId)); Logger_.information(fmt::format("RESEND-MFA-CODE({}): Request for {}", Request->clientAddress().toString(), userId));
if(Obj->has("uuid")) { if(Obj->has("uuid")) {
auto uuid = Obj->get("uuid").toString(); auto uuid = Obj->get("uuid").toString();
@@ -118,7 +118,7 @@ namespace OpenWifi {
return UnAuthorized(RESTAPI::Errors::InvalidCredentials, BAD_MFA_TRANSACTION); return UnAuthorized(RESTAPI::Errors::InvalidCredentials, BAD_MFA_TRANSACTION);
} }
if(GetBoolParameter(RESTAPI::Protocol::COMPLETEMFACHALLENGE,false)) { if(GetBoolParameter(RESTAPI::Protocol::COMPLETEMFACHALLENGE)) {
Logger_.information(fmt::format("COMPLETE-MFA-CHALLENGE({}): Request for {}", Request->clientAddress().toString(), userId)); Logger_.information(fmt::format("COMPLETE-MFA-CHALLENGE({}): Request for {}", Request->clientAddress().toString(), userId));
if(Obj->has("uuid") && Obj->has("answer")) { if(Obj->has("uuid") && Obj->has("answer")) {
SecurityObjects::UserInfoAndPolicy UInfo; SecurityObjects::UserInfoAndPolicy UInfo;