stephb9959
2022-07-25 11:13:48 -07:00
parent 6d9a1cac09
commit e6c196cd67
6 changed files with 19 additions and 11 deletions

View File

@@ -53,7 +53,7 @@ namespace OpenWifi {
i.action==OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP ) && !StorageService()->SubDB().GetUserById(i.userId,UInfo)) {
StorageService()->ActionLinksDB().CancelAction(i.id);
continue;
} else if((i.action=OpenWifi::SecurityObjects::LinkActions::EMAIL_INVITATION) &&
} else if((i.action==OpenWifi::SecurityObjects::LinkActions::EMAIL_INVITATION) &&
(OpenWifi::Now()-i.created)>(24*60*60)) {
StorageService()->ActionLinksDB().CancelAction(i.id);
continue;

View File

@@ -240,7 +240,8 @@ namespace OpenWifi {
return SendHTMLFileBack(FormFile, FormVars);
}
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.validated = true;
UInfo.lastEmailCheck = OpenWifi::Now();

View File

@@ -61,7 +61,7 @@ namespace OpenWifi {
PendingMessages_.push_back(MessageEvent{.Posted= OpenWifi::Now(),
.LastTry=0,
.Sent=0,
.File=Poco::File(TemplateDir_ + "/" + Name + (UseHTML_ ? ".html" : ".txt")),
.TemplateName=Name,
.Attrs=Attrs});
return true;
}
@@ -144,11 +144,14 @@ namespace OpenWifi {
std::string Content = Msg.Attrs.find(TEXT)->second;
Message->addContent(new Poco::Net::StringPartSource(Content));
} else {
std::string Content = Utils::LoadFile(Msg.File);
Types::StringPairVec Variables;
FillVariables(Msg.Attrs, Variables);
Utils::ReplaceVariables(Content, Variables);
Message->addContent(new Poco::Net::StringPartSource(Content, UseHTML_ ? "text/html" : "text/plain"));
for(const auto &format:{"html","txt"}) {
std::string Content = Utils::LoadFile(TemplateDir_ + Msg.TemplateName + "." + format );
Types::StringPairVec Variables;
FillVariables(Msg.Attrs, Variables);
Utils::ReplaceVariables(Content, Variables);
Message->addContent(
new Poco::Net::StringPartSource(Content, (strcmp(format,"html") == 0 ? "text/html" : "text/plain") ));
}
}
auto Logo = Msg.Attrs.find(LOGO);

View File

@@ -73,7 +73,7 @@ namespace OpenWifi {
uint64_t Posted=0;
uint64_t LastTry=0;
uint64_t Sent=0;
Poco::File File;
std::string TemplateName;
MessageAttributes Attrs;
};

View File

@@ -2,7 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>eMail Verification</title>
</head>
<body>

View File

@@ -2,7 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>Password Reset</title>
</head>
<body>