mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 19:27:59 +00:00
Adding password web password reset
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "Poco/Logger.h"
|
||||
#include "Poco/Message.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "Poco/Path.h"
|
||||
|
||||
#include "uCentralProtocol.h"
|
||||
#include "Daemon.h"
|
||||
@@ -399,4 +401,46 @@ namespace uCentral::Utils {
|
||||
// try to match the string with the regular expression
|
||||
return std::regex_match(email, pattern);
|
||||
}
|
||||
|
||||
std::string LoadFile( const Poco::File & F) {
|
||||
std::string Result;
|
||||
try {
|
||||
std::ostringstream OS;
|
||||
std::ifstream IF(F.path());
|
||||
Poco::StreamCopier::copyStream(IF, OS);
|
||||
Result = OS.str();
|
||||
} catch (...) {
|
||||
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
void ReplaceVariables( std::string & Content , const Types::StringPairVec & P) {
|
||||
for(const auto &[Variable,Value]:P) {
|
||||
Poco::replaceInPlace(Content,"${" + Variable + "}", Value);
|
||||
}
|
||||
}
|
||||
|
||||
std::string FindMediaType(const Poco::File &F) {
|
||||
Poco::Path P(F.path());
|
||||
const auto E = P.getExtension();
|
||||
if(E=="png")
|
||||
return "image/png";
|
||||
if(E=="gif")
|
||||
return "image/gif";
|
||||
if(E=="jpeg")
|
||||
return "image/jpeg";
|
||||
if(E=="jpg")
|
||||
return "image/jpeg";
|
||||
if(E=="svg")
|
||||
return "image/svg";
|
||||
if(E=="html")
|
||||
return "text/html";
|
||||
if(E=="css")
|
||||
return "text/css";
|
||||
if(E=="js")
|
||||
return "application/javascript";
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user