X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Faddpeerpage.cpp;h=4453af5a92f681dd8591e5182c013a372ec8235f;hb=fcb124f8d6d3f5678e82049fb8e5e23c8cfaec6d;hp=d97d5961bb1fa82121cc3d300533d9db2644877f;hpb=8a0a83a78390f22f99d4487cda2569909dfbc28e;p=fms.git diff --git a/src/http/pages/addpeerpage.cpp b/src/http/pages/addpeerpage.cpp index d97d596..4453af5 100644 --- a/src/http/pages/addpeerpage.cpp +++ b/src/http/pages/addpeerpage.cpp @@ -1,6 +1,8 @@ #include "../../../include/http/pages/addpeerpage.h" #include "../../../include/stringfunctions.h" -#include "../../../include/datetime.h" + +#include +#include #ifdef XMEM #include @@ -10,9 +12,9 @@ const std::string AddPeerPage::GeneratePage(const std::string &method, const std { std::string content=""; - if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="add") + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="add" && ValidateFormPassword(queryvars)) { - DateTime date; + Poco::DateTime date; std::string publickey=""; if(queryvars.find("publickey")!=queryvars.end()) { @@ -20,10 +22,9 @@ const std::string AddPeerPage::GeneratePage(const std::string &method, const std } if(publickey!="" && publickey.find("SSK@")==0 && publickey[publickey.size()-1]=='/') { - date.SetToGMTime(); SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES(?,?,?);"); st.Bind(0,publickey); - st.Bind(1,date.Format("%Y-%m-%d %H:%M:%S")); + st.Bind(1,Poco::DateTimeFormatter::format(date,"%Y-%m-%d %H:%M:%S")); st.Bind(2,"manually"); st.Step(); st.Reset(); @@ -32,6 +33,7 @@ const std::string AddPeerPage::GeneratePage(const std::string &method, const std content+="

Add Peer

"; content+="
"; + content+=CreateFormPassword(); content+=""; content+="Public Key : "; content+=""; @@ -41,7 +43,7 @@ const std::string AddPeerPage::GeneratePage(const std::string &method, const std content+=""; content+="
"; - return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content); + return StringFunctions::Replace(m_template,"[CONTENT]",content); } const bool AddPeerPage::WillHandleURI(const std::string &uri)