X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fcreateidentitypage.cpp;h=10152ba9c479d7346af2ca1ad72334ce54c9dc02;hb=fcb124f8d6d3f5678e82049fb8e5e23c8cfaec6d;hp=f993a3981459c9c0ea35e783ba337b3e9b361d6f;hpb=107bd97018964d48425306026d06afd038e84db0;p=fms.git diff --git a/src/http/pages/createidentitypage.cpp b/src/http/pages/createidentitypage.cpp index f993a39..10152ba 100644 --- a/src/http/pages/createidentitypage.cpp +++ b/src/http/pages/createidentitypage.cpp @@ -1,6 +1,8 @@ #include "../../../include/http/pages/createidentitypage.h" #include "../../../include/stringfunctions.h" -#include "../../../include/datetime.h" + +#include +#include #ifdef XMEM #include @@ -10,12 +12,11 @@ const std::string CreateIdentityPage::GeneratePage(const std::string &method, co { std::string content=""; - if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="create") + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="create" && ValidateFormPassword(queryvars)) { SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublishTrustList,DateCreated) VALUES(?,'false',?);"); std::string name=""; - DateTime date; - date.SetToGMTime(); + Poco::DateTime date; if(queryvars.find("name")!=queryvars.end()) { @@ -23,22 +24,26 @@ const std::string CreateIdentityPage::GeneratePage(const std::string &method, co } st.Bind(0,name); - 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.Step(); + // insert all identities not in trust list already + m_db->Execute("INSERT INTO tblIdentityTrust(LocalIdentityID,IdentityID) SELECT LocalIdentityID,IdentityID FROM tblLocalIdentity,tblIdentity WHERE LocalIdentityID || '_' || IdentityID NOT IN (SELECT LocalIdentityID || '_' || IdentityID FROM tblIdentityTrust);"); + content+="

Created Identity

"; } else { content+="

Create Identity

"; content+="
"; + content+=CreateFormPassword(); content+=""; content+="Name : "; 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 CreateIdentityPage::WillHandleURI(const std::string &uri)