X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Flocalidentitiespage.cpp;h=7910789d3f3f45b20cbd5481d5bf6b0fe398364c;hb=4e96d123460d6363cf7274e36bd9357768eb86ad;hp=5fa76b5053c239d1ac667b646238835821a4ac0a;hpb=dec33c63afafabf83c3039e916725cac6faef9b3;p=fms.git diff --git a/src/http/pages/localidentitiespage.cpp b/src/http/pages/localidentitiespage.cpp index 5fa76b5..7910789 100644 --- a/src/http/pages/localidentitiespage.cpp +++ b/src/http/pages/localidentitiespage.cpp @@ -18,11 +18,13 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c content+=""; content+="
Export IdentitiesImport Identities
"; content+="
"; + content+=CreateFormPassword(); content+=""; content+=""; content+="
"; content+="
"; content+="
"; + content+=CreateFormPassword(); content+=""; content+=""; content+=""; @@ -31,10 +33,11 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c content+="
"; - content+=""; + content+="
NameSingle UsePublish Trust ListPublish Board ListPublish FreesiteMin Message DelayMax Message DelayAnnounced? *
"; SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID,tblLocalIdentity.PublishFreesite,tblLocalIdentity.MinMessageDelay,tblLocalIdentity.MaxMessageDelay FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;"); st.Step(); + SQLite3DB::Statement st2=m_db->Prepare("SELECT IdentityID FROM tblIdentity WHERE PublicKey=?;"); SQLite3DB::Statement trustst=m_db->Prepare("SELECT COUNT(*) FROM tblPeerTrust LEFT JOIN tblIdentity ON tblPeerTrust.TargetIdentityID=tblIdentity.IdentityID WHERE tblIdentity.PublicKey=? GROUP BY tblPeerTrust.TargetIdentityID;"); @@ -51,6 +54,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c std::string publishfreesite=""; std::string minmessagedelay="0"; std::string maxmessagedelay="0"; + std::string identityidstr=""; st.ResultText(0,id); st.ResultText(1,name); @@ -62,8 +66,26 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c st.ResultText(8,minmessagedelay); st.ResultText(9,maxmessagedelay); + st2.Bind(0,publickey); + st2.Step(); + if(st2.RowReturned()) + { + st2.ResultText(0,identityidstr); + } + st2.Reset(); + content+=""; - content+=""; + content+=""; content+=""; content+=""; content+=""; @@ -86,7 +108,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c trustst.Reset(); content+=""; - content+=""; + content+=""; content+=""; content+=""; st.Step(); @@ -94,7 +116,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c } content+="
NameSingle UsePublish Trust ListPublish Board ListPublish FreesiteMin Message DelayMax Message DelayAnnounced? *
"+SanitizeOutput(CreateShortIdentityName(name,publickey))+""+CreateFormPassword()+""; + if(identityidstr!="") + { + content+=""; + } + content+=SanitizeOutput(CreateShortIdentityName(name,publickey)); + if(identityidstr!="") + { + content+=""; + } + content+=""+CreateTrueFalseDropDown("singleuse["+countstr+"]",singleuse)+""+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+""+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+"
"+CreateFormPassword()+"
"+publickey+"
"; - content+="

* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity. The number in parenthesis is how many trust lists that identity appears in.

"; + content+="

* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity. You must trust other identities' trust lists for this to happen. The number in parenthesis is how many trust lists the identity appears in.

"; content+="

Single Use Identities will automatically be deleted 7 days after creation.

"; content+="

Messages that each identity sends may be delayed by a random number of minutes between min and max. Set both to 0 to send messages as soon as possible.

"; @@ -232,7 +254,7 @@ void LocalIdentitiesPage::handleRequest(Poco::Net::HTTPServerRequest &request, P CreateQueryVarMap(request,vars); std::string formaction=""; - if(vars.find("formaction")!=vars.end()) + if(vars.find("formaction")!=vars.end() && ValidateFormPassword(vars)) { formaction=(*vars.find("formaction")).second; if(formaction=="update")