Implementing several adjustments for security reasons.

This commit is contained in:
stephb9959
2021-11-09 11:57:38 -08:00
parent a96f673380
commit 00742a5d0a
2 changed files with 0 additions and 24 deletions

View File

@@ -25,30 +25,22 @@ namespace OpenWifi {
Running_ = true ;
while(Running_) {
std::cout << __func__ << ":" << __LINE__ << std::endl;
Poco::Thread::trySleep(2000);
std::cout << __func__ << ":" << __LINE__ << std::endl;
if(!Running_)
break;
std::cout << __func__ << ":" << __LINE__ << std::endl;
std::vector<SecurityObjects::ActionLink> Links;
{
std::lock_guard G(Mutex_);
StorageService()->GetActions(Links);
}
std::cout << __func__ << ":" << __LINE__ << std::endl;
if(Links.empty())
continue;
std::cout << __func__ << ":" << __LINE__ << std::endl;
for(auto &i:Links) {
std::cout << __func__ << ":" << __LINE__ << std::endl;
if(!Running_)
break;
std::cout << __func__ << ":" << __LINE__ << std::endl;
if(i.action=="forgot_password") {
if(AuthService::SendEmailToUser(i.id, i.userId, AuthService::FORGOT_PASSWORD)) {
Logger_.information(Poco::format("Send password reset link to %s",i.userId));

View File

@@ -46,23 +46,15 @@ namespace OpenWifi {
bool Storage::CreateAction( SecurityObjects::ActionLink & A) {
try {
std::cout << __func__ << ":" << __LINE__ << std::endl;
Poco::Data::Session Sess = Pool_->get();
std::cout << __func__ << ":" << __LINE__ << std::endl;
Poco::Data::Statement Insert(Sess);
std::cout << __func__ << ":" << __LINE__ << std::endl;
std::string St2{
"INSERT INTO ActionLinks (" + AllActionLinksFieldsForSelect + ") VALUES(" + AllActionLinksValuesForSelect + ")"};
std::cout << __func__ << ":" << __LINE__ << std::endl;
ActionLinkRecord AR;
std::cout << __func__ << ":" << __LINE__ << std::endl;
Convert(A, AR);
std::cout << __func__ << ":" << __LINE__ << std::endl;
Insert << ConvertParams(St2),
Poco::Data::Keywords::use(AR);
std::cout << __func__ << ":" << __LINE__ << std::endl;
Insert.execute();
std::cout << __func__ << ":" << __LINE__ << std::endl;
return true;
} catch (const Poco::Exception &E) {
Logger_.log(E);
@@ -72,30 +64,22 @@ namespace OpenWifi {
bool Storage::GetActions(std::vector<SecurityObjects::ActionLink> &Links, uint64_t Max) {
try {
std::cout << __func__ << ":" << __LINE__ << std::endl;
Poco::Data::Session Sess = Pool_->get();
std::cout << __func__ << ":" << __LINE__ << std::endl;
Poco::Data::Statement Select(Sess);
std::cout << __func__ << ":" << __LINE__ << std::endl;
ActionLinkRecordList ARL;
std::cout << __func__ << ":" << __LINE__ << std::endl;
std::string St2{
"SELECT " + AllActionLinksFieldsForSelect + " From ActionLinks where sent=0 and canceled=0"};
std::cout << __func__ << ":" << __LINE__ << std::endl;
Select << ConvertParams(St2),
Poco::Data::Keywords::into(ARL);
Select.execute();
std::cout << __func__ << ":" << __LINE__ << std::endl;
for(const auto &i:ARL) {
std::cout << __func__ << ":" << __LINE__ << std::endl;
SecurityObjects::ActionLink L;
Convert(i,L);
Links.emplace_back(L);
}
std::cout << __func__ << ":" << __LINE__ << std::endl;
return true;
} catch (const Poco::Exception &E) {