X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fcreateidentitypage.cpp;h=0e4d41166d3b631b32245c474de12409eb399991;hb=c0ebc7b53a977885ebc2d3a679c586ae20c0bc4a;hp=2c55c02c8b34320ece8fb5a064d133187018b6e6;hpb=f208e33c29132aacaec448e74341edea1b925a2a;p=fms.git diff --git a/src/http/pages/createidentitypage.cpp b/src/http/pages/createidentitypage.cpp index 2c55c02..0e4d411 100644 --- a/src/http/pages/createidentitypage.cpp +++ b/src/http/pages/createidentitypage.cpp @@ -1,6 +1,9 @@ #include "../../../include/http/pages/createidentitypage.h" #include "../../../include/stringfunctions.h" +#include +#include + #ifdef XMEM #include #endif @@ -9,10 +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) VALUES(?,'true');"); + SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublishTrustList,DateCreated) VALUES(?,'false',?);"); std::string name=""; + Poco::DateTime date; if(queryvars.find("name")!=queryvars.end()) { @@ -20,21 +24,27 @@ const std::string CreateIdentityPage::GeneratePage(const std::string &method, co } st.Bind(0,name); + 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

"; + content+="You must have at least 1 local identity that has set explicit trust list trust for one or more peers who are publishing trust lists or you will not be able to learn about other identities."; } else { content+="

Create Identity

"; content+="
"; + content+=CreateFormPassword(); content+=""; - content+="Name : "; + 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)