Cleanup for null oauth body.

This commit is contained in:
stephb9959
2022-05-09 09:43:20 -07:00
parent 097fe2e436
commit 7591b8cd44
19 changed files with 46 additions and 42 deletions

2
build
View File

@@ -1 +1 @@
52 53

View File

@@ -282,7 +282,7 @@ namespace OpenWifi {
} }
[[nodiscard]] std::string AuthService::GenerateTokenHMAC(const std::string & UserName, [[maybe_unused]] ACCESS_TYPE Type) { [[nodiscard]] std::string AuthService::GenerateTokenHMAC(const std::string & UserName, [[maybe_unused]] ACCESS_TYPE Type) {
std::string Identity(UserName + ":" + fmt::format("{}",std::time(nullptr)) + ":" + std::to_string(rand())); std::string Identity(UserName + ":" + fmt::format("{}",OpenWifi::Now()) + ":" + std::to_string(rand()));
HMAC_.update(Identity); HMAC_.update(Identity);
return Poco::DigestEngine::digestToHex(HMAC_.digest()); return Poco::DigestEngine::digestToHex(HMAC_.digest());
} }
@@ -498,14 +498,14 @@ namespace OpenWifi {
UInfo.webtoken.errorCode = 1; UInfo.webtoken.errorCode = 1;
return PASSWORD_ALREADY_USED; return PASSWORD_ALREADY_USED;
} }
UInfo.userinfo.lastPasswordChange = std::time(nullptr); UInfo.userinfo.lastPasswordChange = OpenWifi::Now();
UInfo.userinfo.changePassword = false; UInfo.userinfo.changePassword = false;
UInfo.userinfo.modified = std::time(nullptr); UInfo.userinfo.modified = OpenWifi::Now();
StorageService()->UserDB().UpdateUserInfo(AUTHENTICATION_SYSTEM, UInfo.userinfo.id,UInfo.userinfo); StorageService()->UserDB().UpdateUserInfo(AUTHENTICATION_SYSTEM, UInfo.userinfo.id,UInfo.userinfo);
} }
// so we have a good password, password up date has taken place if need be, now generate the token. // so we have a good password, password up date has taken place if need be, now generate the token.
UInfo.userinfo.lastLogin=std::time(nullptr); UInfo.userinfo.lastLogin=OpenWifi::Now();
StorageService()->UserDB().SetLastLogin(UInfo.userinfo.id); StorageService()->UserDB().SetLastLogin(UInfo.userinfo.id);
CreateToken(UserName, UInfo ); CreateToken(UserName, UInfo );
@@ -544,14 +544,14 @@ namespace OpenWifi {
UInfo.webtoken.errorCode = 1; UInfo.webtoken.errorCode = 1;
return PASSWORD_ALREADY_USED; return PASSWORD_ALREADY_USED;
} }
UInfo.userinfo.lastPasswordChange = std::time(nullptr); UInfo.userinfo.lastPasswordChange = OpenWifi::Now();
UInfo.userinfo.changePassword = false; UInfo.userinfo.changePassword = false;
UInfo.userinfo.modified = std::time(nullptr); UInfo.userinfo.modified = OpenWifi::Now();
StorageService()->SubDB().UpdateUserInfo(AUTHENTICATION_SYSTEM, UInfo.userinfo.id,UInfo.userinfo); StorageService()->SubDB().UpdateUserInfo(AUTHENTICATION_SYSTEM, UInfo.userinfo.id,UInfo.userinfo);
} }
// so we have a good password, password update has taken place if need be, now generate the token. // so we have a good password, password update has taken place if need be, now generate the token.
UInfo.userinfo.lastLogin=std::time(nullptr); UInfo.userinfo.lastLogin=OpenWifi::Now();
StorageService()->SubDB().SetLastLogin(UInfo.userinfo.id); StorageService()->SubDB().SetLastLogin(UInfo.userinfo.id);
CreateSubToken(UserName, UInfo ); CreateSubToken(UserName, UInfo );
@@ -648,7 +648,7 @@ namespace OpenWifi {
A.action = OpenWifi::SecurityObjects::LinkActions::VERIFY_EMAIL; A.action = OpenWifi::SecurityObjects::LinkActions::VERIFY_EMAIL;
A.userId = UInfo.id; A.userId = UInfo.id;
A.id = MicroService::CreateUUID(); A.id = MicroService::CreateUUID();
A.created = std::time(nullptr); A.created = OpenWifi::Now();
A.expires = A.created + 24*60*60; A.expires = A.created + 24*60*60;
A.userAction = true; A.userAction = true;
StorageService()->ActionLinksDB().CreateAction(A); StorageService()->ActionLinksDB().CreateAction(A);
@@ -663,7 +663,7 @@ namespace OpenWifi {
A.action = OpenWifi::SecurityObjects::LinkActions::SUB_VERIFY_EMAIL; A.action = OpenWifi::SecurityObjects::LinkActions::SUB_VERIFY_EMAIL;
A.userId = UInfo.id; A.userId = UInfo.id;
A.id = MicroService::CreateUUID(); A.id = MicroService::CreateUUID();
A.created = std::time(nullptr); A.created = OpenWifi::Now();
A.expires = A.created + 24*60*60; A.expires = A.created + 24*60*60;
A.userAction = false; A.userAction = false;
StorageService()->ActionLinksDB().CreateAction(A); StorageService()->ActionLinksDB().CreateAction(A);

View File

@@ -28,7 +28,7 @@ namespace OpenWifi {
std::string Challenge = MakeChallenge(); std::string Challenge = MakeChallenge();
std::string uuid = MicroService::CreateUUID(); std::string uuid = MicroService::CreateUUID();
uint64_t Created = std::time(nullptr); uint64_t Created = OpenWifi::Now();
ChallengeStart.set("uuid",uuid); ChallengeStart.set("uuid",uuid);
ChallengeStart.set("created", Created); ChallengeStart.set("created", Created);
@@ -107,7 +107,7 @@ namespace OpenWifi {
void MFAServer::CleanCache() { void MFAServer::CleanCache() {
// it is assumed that you have locked Cache_ at this point. // it is assumed that you have locked Cache_ at this point.
uint64_t Now = std::time(nullptr); uint64_t Now = OpenWifi::Now();
for(auto i=begin(Cache_);i!=end(Cache_);) { for(auto i=begin(Cache_);i!=end(Cache_);) {
if((Now-i->second.Created)>300) { if((Now-i->second.Created)>300) {
i = Cache_.erase(i); i = Cache_.erase(i);

View File

@@ -25,8 +25,7 @@ namespace OpenWifi {
return UnAuthorized(RESTAPI::Errors::EXPIRED_TOKEN); return UnAuthorized(RESTAPI::Errors::EXPIRED_TOKEN);
return UnAuthorized(RESTAPI::Errors::INVALID_TOKEN); return UnAuthorized(RESTAPI::Errors::INVALID_TOKEN);
} }
bool GetMe = GetBoolParameter(RESTAPI::Protocol::ME, false); if(GetBoolParameter(RESTAPI::Protocol::ME)) {
if(GetMe) {
Logger_.information(fmt::format("REQUEST-ME({}): Request for {}", Request->clientAddress().toString(), UserInfo_.userinfo.email)); Logger_.information(fmt::format("REQUEST-ME({}): Request for {}", Request->clientAddress().toString(), UserInfo_.userinfo.email));
Poco::JSON::Object Me; Poco::JSON::Object Me;
SecurityObjects::UserInfo ReturnedUser = UserInfo_.userinfo; SecurityObjects::UserInfo ReturnedUser = UserInfo_.userinfo;
@@ -56,7 +55,12 @@ namespace OpenWifi {
} }
void RESTAPI_oauth2_handler::DoPost() { void RESTAPI_oauth2_handler::DoPost() {
const auto & Obj = ParsedBody_; const auto & Obj = ParsedBody_;
if(Obj == nullptr) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
auto userId = GetS(RESTAPI::Protocol::USERID, Obj); auto userId = GetS(RESTAPI::Protocol::USERID, Obj);
auto password = GetS(RESTAPI::Protocol::PASSWORD, Obj); auto password = GetS(RESTAPI::Protocol::PASSWORD, Obj);
auto newPassword = GetS(RESTAPI::Protocol::NEWPASSWORD, Obj); auto newPassword = GetS(RESTAPI::Protocol::NEWPASSWORD, Obj);
@@ -164,7 +168,7 @@ namespace OpenWifi {
case PASSWORD_CHANGE_REQUIRED: case PASSWORD_CHANGE_REQUIRED:
return UnAuthorized(RESTAPI::Errors::PASSWORD_CHANGE_REQUIRED); return UnAuthorized(RESTAPI::Errors::PASSWORD_CHANGE_REQUIRED);
default: default:
return UnAuthorized(RESTAPI::Errors::INVALID_CREDENTIALS); break; return UnAuthorized(RESTAPI::Errors::INVALID_CREDENTIALS);
} }
return; return;
} }

View File

@@ -25,7 +25,7 @@ namespace OpenWifi {
} }
P.id = UserInfo_.userinfo.id; P.id = UserInfo_.userinfo.id;
P.modified = std::time(nullptr); P.modified = OpenWifi::Now();
StorageService()->PreferencesDB().SetPreferences(P); StorageService()->PreferencesDB().SetPreferences(P);
Poco::JSON::Object Answer; Poco::JSON::Object Answer;

View File

@@ -40,8 +40,8 @@ namespace OpenWifi {
NewSub.signingUp = signupUUID; NewSub.signingUp = signupUUID;
NewSub.waitingForEmailCheck = true; NewSub.waitingForEmailCheck = true;
NewSub.name = UserName; NewSub.name = UserName;
NewSub.modified = std::time(nullptr); NewSub.modified = OpenWifi::Now();
NewSub.creationDate = std::time(nullptr); NewSub.creationDate = OpenWifi::Now();
NewSub.id = MicroService::instance().CreateUUID(); NewSub.id = MicroService::instance().CreateUUID();
NewSub.email = UserName; NewSub.email = UserName;
NewSub.userRole = SecurityObjects::SUBSCRIBER; NewSub.userRole = SecurityObjects::SUBSCRIBER;
@@ -56,7 +56,7 @@ namespace OpenWifi {
NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP; NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP;
NewLink.id = MicroService::CreateUUID(); NewLink.id = MicroService::CreateUUID();
NewLink.userId = NewSub.id; NewLink.userId = NewSub.id;
NewLink.created = std::time(nullptr); NewLink.created = OpenWifi::Now();
NewLink.expires = NewLink.created + (1*60*60); // 1 hour NewLink.expires = NewLink.created + (1*60*60); // 1 hour
NewLink.userAction = false; NewLink.userAction = false;
StorageService()->ActionLinksDB().CreateAction(NewLink); StorageService()->ActionLinksDB().CreateAction(NewLink);

View File

@@ -89,7 +89,7 @@ namespace OpenWifi {
NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_FORGOT_PASSWORD; NewLink.action = OpenWifi::SecurityObjects::LinkActions::SUB_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 = false; NewLink.userAction = false;
StorageService()->ActionLinksDB().CreateAction(NewLink); StorageService()->ActionLinksDB().CreateAction(NewLink);

View File

@@ -25,7 +25,7 @@ namespace OpenWifi {
} }
P.id = UserInfo_.userinfo.id; P.id = UserInfo_.userinfo.id;
P.modified = std::time(nullptr); P.modified = OpenWifi::Now();
StorageService()->SubPreferencesDB().SetPreferences(P); StorageService()->SubPreferencesDB().SetPreferences(P);
Poco::JSON::Object Answer; Poco::JSON::Object Answer;

View File

@@ -233,7 +233,7 @@ namespace OpenWifi {
SecurityObjects::NoteInfoVec NIV; SecurityObjects::NoteInfoVec NIV;
NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(RawObject->get("notes").toString()); NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(RawObject->get("notes").toString());
for(auto const &i:NIV) { for(auto const &i:NIV) {
SecurityObjects::NoteInfo ii{.created=(uint64_t)std::time(nullptr), .createdBy=UserInfo_.userinfo.email, .note=i.note}; SecurityObjects::NoteInfo ii{.created=(uint64_t)OpenWifi::Now(), .createdBy=UserInfo_.userinfo.email, .note=i.note};
Existing.notes.push_back(ii); Existing.notes.push_back(ii);
} }
} }

View File

@@ -243,7 +243,7 @@ namespace OpenWifi {
SecurityObjects::NoteInfoVec NIV; SecurityObjects::NoteInfoVec NIV;
NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(RawObject->get("notes").toString()); NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(RawObject->get("notes").toString());
for(auto const &i:NIV) { for(auto const &i:NIV) {
SecurityObjects::NoteInfo ii{.created=(uint64_t)std::time(nullptr), .createdBy=UserInfo_.userinfo.email, .note=i.note}; SecurityObjects::NoteInfo ii{.created=(uint64_t)OpenWifi::Now(), .createdBy=UserInfo_.userinfo.email, .note=i.note};
Existing.notes.push_back(ii); Existing.notes.push_back(ii);
} }
} }

View File

@@ -433,7 +433,7 @@ namespace OpenWifi::SecurityObjects {
SecurityObjects::NoteInfoVec NIV; SecurityObjects::NoteInfoVec NIV;
NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(Obj->get("notes").toString()); NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(Obj->get("notes").toString());
for(auto const &i:NIV) { for(auto const &i:NIV) {
SecurityObjects::NoteInfo ii{.created=(uint64_t)std::time(nullptr), .createdBy=UInfo.email, .note=i.note}; SecurityObjects::NoteInfo ii{.created=(uint64_t)OpenWifi::Now(), .createdBy=UInfo.email, .note=i.note};
Notes.push_back(ii); Notes.push_back(ii);
} }
} }
@@ -446,7 +446,7 @@ namespace OpenWifi::SecurityObjects {
bool MergeNotes(const NoteInfoVec & NewNotes, const UserInfo &UInfo, NoteInfoVec & ExistingNotes) { bool MergeNotes(const NoteInfoVec & NewNotes, const UserInfo &UInfo, NoteInfoVec & ExistingNotes) {
for(auto const &i:NewNotes) { for(auto const &i:NewNotes) {
SecurityObjects::NoteInfo ii{.created=(uint64_t)std::time(nullptr), .createdBy=UInfo.email, .note=i.note}; SecurityObjects::NoteInfo ii{.created=(uint64_t)OpenWifi::Now(), .createdBy=UInfo.email, .note=i.note};
ExistingNotes.push_back(ii); ExistingNotes.push_back(ii);
} }
return true; return true;

View File

@@ -55,7 +55,7 @@ namespace OpenWifi {
std::string UserTypeToString(USER_ROLE U); std::string UserTypeToString(USER_ROLE U);
struct NoteInfo { struct NoteInfo {
uint64_t created=0; // = std::time(nullptr); uint64_t created=0; // = OpenWifi::Now();
std::string createdBy; std::string createdBy;
std::string note; std::string note;
@@ -94,7 +94,7 @@ namespace OpenWifi {
std::string uuid; std::string uuid;
std::string question; std::string question;
std::string method; std::string method;
uint64_t created = std::time(nullptr); uint64_t created = OpenWifi::Now();
void to_json(Poco::JSON::Object &Obj) const; void to_json(Poco::JSON::Object &Obj) const;
bool from_json(const Poco::JSON::Object::Ptr &Obj); bool from_json(const Poco::JSON::Object::Ptr &Obj);
@@ -256,7 +256,7 @@ namespace OpenWifi {
std::string locale; std::string locale;
std::string message; std::string message;
uint64_t sent=0; uint64_t sent=0;
uint64_t created=std::time(nullptr); uint64_t created=OpenWifi::Now();
uint64_t expires=0; uint64_t expires=0;
uint64_t completed=0; uint64_t completed=0;
uint64_t canceled=0; uint64_t canceled=0;

View File

@@ -34,7 +34,7 @@ namespace OpenWifi {
} }
void SMSSender::CleanCache() { void SMSSender::CleanCache() {
uint64_t Now=std::time(nullptr); uint64_t Now=OpenWifi::Now();
for(auto i=begin(Cache_);i!=end(Cache_);) { for(auto i=begin(Cache_);i!=end(Cache_);) {
if((Now-i->Created)>300) if((Now-i->Created)>300)
i = Cache_.erase(i); i = Cache_.erase(i);
@@ -46,7 +46,7 @@ namespace OpenWifi {
bool SMSSender::StartValidation(const std::string &Number, const std::string &UserName) { bool SMSSender::StartValidation(const std::string &Number, const std::string &UserName) {
std::lock_guard G(Mutex_); std::lock_guard G(Mutex_);
CleanCache(); CleanCache();
uint64_t Now=std::time(nullptr); uint64_t Now=OpenWifi::Now();
auto Challenge = MFAServer::MakeChallenge(); auto Challenge = MFAServer::MakeChallenge();
Cache_.emplace_back(SMSValidationCacheEntry{.Number=Number, .Code=Challenge, .UserName=UserName, .Created=Now}); Cache_.emplace_back(SMSValidationCacheEntry{.Number=Number, .Code=Challenge, .UserName=UserName, .Created=Now});
std::string Message = "Please enter the following code on your login screen: " + Challenge; std::string Message = "Please enter the following code on your login screen: " + Challenge;

View File

@@ -18,7 +18,7 @@ namespace OpenWifi {
std::string Number; std::string Number;
std::string Code; std::string Code;
std::string UserName; std::string UserName;
uint64_t Created = std::time(nullptr); uint64_t Created = OpenWifi::Now();
bool Validated = false; bool Validated = false;
}; };

View File

@@ -55,7 +55,7 @@ namespace OpenWifi {
bool SMTPMailerService::SendMessage([[maybe_unused]] const std::string &Recipient, const std::string &Name, const MessageAttributes &Attrs) { bool SMTPMailerService::SendMessage([[maybe_unused]] const std::string &Recipient, const std::string &Name, const MessageAttributes &Attrs) {
std::lock_guard G(Mutex_); std::lock_guard G(Mutex_);
PendingMessages_.push_back(MessageEvent{.Posted=(uint64_t )std::time(nullptr), PendingMessages_.push_back(MessageEvent{.Posted= OpenWifi::Now(),
.LastTry=0, .LastTry=0,
.Sent=0, .Sent=0,
.File=Poco::File(TemplateDir_ + "/" +Name), .File=Poco::File(TemplateDir_ + "/" +Name),

View File

@@ -22,7 +22,7 @@ namespace OpenWifi {
U.email = MicroService::instance().ConfigGetString("authentication.default.username", ""); U.email = MicroService::instance().ConfigGetString("authentication.default.username", "");
U.id = NewDefaultUseridStockUUID; U.id = NewDefaultUseridStockUUID;
U.userRole = SecurityObjects::ROOT; U.userRole = SecurityObjects::ROOT;
U.creationDate = std::time(nullptr); U.creationDate = OpenWifi::Now();
U.validated = true; U.validated = true;
U.name = "Default User"; U.name = "Default User";
U.description = "Default user should be deleted."; U.description = "Default user should be deleted.";

View File

@@ -53,7 +53,7 @@ namespace OpenWifi {
} }
static bool ValidateCode( const std::string &Secret, const std::string &Code, std::string & Expecting) { static bool ValidateCode( const std::string &Secret, const std::string &Code, std::string & Expecting) {
uint64_t Now = std::time(nullptr); uint64_t Now = OpenWifi::Now();
uint32_t p = CppTotp::totp(CppTotp::Bytes::ByteString{ (const u_char *)Secret.c_str()}, Now, 0, 30, 6); uint32_t p = CppTotp::totp(CppTotp::Bytes::ByteString{ (const u_char *)Secret.c_str()}, Now, 0, 30, 6);
char buffer[16]; char buffer[16];
sprintf(buffer,"%06u",p); sprintf(buffer,"%06u",p);
@@ -76,7 +76,7 @@ namespace OpenWifi {
if(Reset) { if(Reset) {
std::string Base32Secret; std::string Base32Secret;
Hint->second.Subscriber = Subscriber; Hint->second.Subscriber = Subscriber;
Hint->second.Start = std::time(nullptr); Hint->second.Start = OpenWifi::Now();
Hint->second.Done = 0; Hint->second.Done = 0;
Hint->second.Verifications = 0; Hint->second.Verifications = 0;
Hint->second.Secret = GenerateSecret(20,Base32Secret); Hint->second.Secret = GenerateSecret(20,Base32Secret);
@@ -156,7 +156,7 @@ namespace OpenWifi {
inline bool CompleteValidation(const SecurityObjects::UserInfo &User, bool Subscriber, std::string & Secret) { inline bool CompleteValidation(const SecurityObjects::UserInfo &User, bool Subscriber, std::string & Secret) {
auto Hint = Cache_.find(User.id); auto Hint = Cache_.find(User.id);
uint64_t Now = std::time(nullptr); uint64_t Now = OpenWifi::Now();
if(Hint!=Cache_.end() && Subscriber==Hint->second.Subscriber && (Now-Hint->second.Start)<(15*60) && Hint->second.Done!=0) { if(Hint!=Cache_.end() && Subscriber==Hint->second.Subscriber && (Now-Hint->second.Start)<(15*60) && Hint->second.Done!=0) {
Secret = Hint->second.Secret; Secret = Hint->second.Secret;
Cache_.erase(Hint); Cache_.erase(Hint);

View File

@@ -67,7 +67,7 @@ namespace OpenWifi {
bool ActionLinkDB::SentAction(std::string &ActionId) { bool ActionLinkDB::SentAction(std::string &ActionId) {
SecurityObjects::ActionLink A; SecurityObjects::ActionLink A;
if(GetRecord("id",ActionId,A)) { if(GetRecord("id",ActionId,A)) {
A.sent = std::time(nullptr); A.sent = OpenWifi::Now();
return UpdateRecord("id",ActionId,A); return UpdateRecord("id",ActionId,A);
} }
return false; return false;
@@ -80,7 +80,7 @@ namespace OpenWifi {
bool ActionLinkDB::CompleteAction(std::string &ActionId) { bool ActionLinkDB::CompleteAction(std::string &ActionId) {
SecurityObjects::ActionLink A; SecurityObjects::ActionLink A;
if(GetRecord("id",ActionId,A)) { if(GetRecord("id",ActionId,A)) {
A.completed = std::time(nullptr); A.completed = OpenWifi::Now();
return UpdateRecord("id",ActionId,A); return UpdateRecord("id",ActionId,A);
} }
return false; return false;
@@ -89,14 +89,14 @@ namespace OpenWifi {
bool ActionLinkDB::CancelAction(std::string &ActionId) { bool ActionLinkDB::CancelAction(std::string &ActionId) {
SecurityObjects::ActionLink A; SecurityObjects::ActionLink A;
if(GetRecord("id",ActionId,A)) { if(GetRecord("id",ActionId,A)) {
A.canceled = std::time(nullptr); A.canceled = OpenWifi::Now();
return UpdateRecord("id",ActionId,A); return UpdateRecord("id",ActionId,A);
} }
return false; return false;
} }
void ActionLinkDB::CleanOldActionLinks() { void ActionLinkDB::CleanOldActionLinks() {
uint64_t CutOff = std::time(nullptr) - (30 * 24 * 60 * 60); uint64_t CutOff = OpenWifi::Now() - (30 * 24 * 60 * 60);
std::string WhereClause{" Created <= " + std::to_string(CutOff) + " "}; std::string WhereClause{" Created <= " + std::to_string(CutOff) + " "};
DeleteRecords(WhereClause); DeleteRecords(WhereClause);
} }

View File

@@ -38,7 +38,7 @@ namespace OpenWifi {
R.sessionId = MakeSessionId(token); R.sessionId = MakeSessionId(token);
R.userId = userId; R.userId = userId;
R.email = email; R.email = email;
R.login = std::time(nullptr); R.login = OpenWifi::Now();
R.logout = 0; R.logout = 0;
CreateRecord(R); CreateRecord(R);
} }
@@ -48,7 +48,7 @@ namespace OpenWifi {
SecurityObjects::LoginRecordInfo R; SecurityObjects::LoginRecordInfo R;
if(GetRecord("session", Session, R)) { if(GetRecord("session", Session, R)) {
R.logout = std::time(nullptr); R.logout = OpenWifi::Now();
UpdateRecord("session", Session, R); UpdateRecord("session", Session, R);
} }
} }