diff --git a/src/cpp/HTTPInterface/CheckTransactionPage.cpp b/src/cpp/HTTPInterface/CheckTransactionPage.cpp index bb6ea922d..407f97bd2 100644 --- a/src/cpp/HTTPInterface/CheckTransactionPage.cpp +++ b/src/cpp/HTTPInterface/CheckTransactionPage.cpp @@ -498,8 +498,8 @@ void CheckTransactionPage::handleRequest(Poco::Net::HTTPServerRequest& request, responseStream << "
\n"; responseStream << "
\n"; responseStream << " \n"; responseStream << "
\n"; responseStream << "
\n"; diff --git a/src/cpp/HTTPInterface/PageRequestHandlerFactory.cpp b/src/cpp/HTTPInterface/PageRequestHandlerFactory.cpp index 8fb8d7834..20e47b344 100644 --- a/src/cpp/HTTPInterface/PageRequestHandlerFactory.cpp +++ b/src/cpp/HTTPInterface/PageRequestHandlerFactory.cpp @@ -19,6 +19,8 @@ #include "CheckTransactionPage.h" #include "ResetPassword.h" +#include "DecodeTransactionPage.h" + #include "../SingletonManager/SessionManager.h" @@ -64,6 +66,13 @@ Poco::Net::HTTPRequestHandler* PageRequestHandlerFactory::createRequestHandler(c return pageRequestHandler; } + if (url_first_part == "/decode_transaction") { + mLogging.information(dateTimeString + " decode"); + auto pageRequestHandler = new DecodeTransactionPage; + pageRequestHandler->setProfiler(timeUsed); + return pageRequestHandler; + } + // check if user has valid session Poco::Net::NameValueCollection cookies; request.getCookies(cookies); diff --git a/src/cpp/controller/User.cpp b/src/cpp/controller/User.cpp index 82e74eea7..9ece8fe62 100644 --- a/src/cpp/controller/User.cpp +++ b/src/cpp/controller/User.cpp @@ -39,14 +39,14 @@ namespace controller { std::vector resultFromDB; // check if search string is email - if (sm->isValid(searchString, VALIDATE_EMAIL)) { + /*if (sm->isValid(searchString, VALIDATE_EMAIL)) { resultFromDB = db->loadFromDB ("email", globalSearch); } - else { - std::vector fieldNames = { "first_name", "last_name" }; - std::vector fieldValues = { globalSearch, globalSearch }; + else {*/ + std::vector fieldNames = { "first_name", "last_name", "email" }; + std::vector fieldValues = { globalSearch, globalSearch, globalSearch }; resultFromDB = db->loadFromDB(fieldNames, fieldValues, model::table::MYSQL_CONDITION_OR); - } + //} db->release(); db = nullptr; diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 610e84f44..bcb72085e 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -22,7 +22,7 @@ int main(int argc, char** argv) printf("error initing sodium, early exit\n"); return -1; } - ServerConfig::g_versionString = "0.11.0"; + ServerConfig::g_versionString = "0.20.KW03.01"; printf("User size: %d Bytes, Session size: %d Bytes\n", sizeof(User), sizeof(Session)); printf("model sizes: User: %d Bytes, EmailOptIn: %d Bytes\n", sizeof(model::table::User), sizeof(model::table::EmailOptIn)); diff --git a/src/cpp/tasks/SigningTransaction.cpp b/src/cpp/tasks/SigningTransaction.cpp index d62d2711d..f3c461781 100644 --- a/src/cpp/tasks/SigningTransaction.cpp +++ b/src/cpp/tasks/SigningTransaction.cpp @@ -198,8 +198,6 @@ int SigningTransaction::run() { sendErrorsAsEmail(); return -8; } - - //Poco::Thread::sleep(10000); return 0; } \ No newline at end of file diff --git a/src/cpsp/decodeTransaction.cpsp b/src/cpsp/decodeTransaction.cpsp new file mode 100644 index 000000000..79d473f1c --- /dev/null +++ b/src/cpsp/decodeTransaction.cpsp @@ -0,0 +1,85 @@ +<%@ page class="DecodeTransactionPage" %> +<%@ page form="true" %> +<%@ page compressed="true" %> +<%@ page baseClass="PageRequestMessagedHandler" %> +<%@ header include="PageRequestMessagedHandler.h" %> +<%! +#include "sodium.h" +#include "../proto/gradido/TransactionBody.pb.h" +%> +<%% + const char* pageName = "Decode Transaction"; + model::messages::gradido::TransactionBody transactionBody; + bool decoded = false; + if(!form.empty()) { + auto base64 = form.get("transaction", ""); + if(base64 != "") { + unsigned char* binBuffer = (unsigned char*)malloc(base64.size()); + size_t resultingBinSize = 0; + size_t base64_size = base64.size(); + if (sodium_base642bin( + binBuffer, base64_size, + base64.data(), base64_size, + nullptr, &resultingBinSize, nullptr, + sodium_base64_VARIANT_ORIGINAL)) + { + free(binBuffer); + addError(new Error("ProcessingTransaction", "error decoding base64")); + } else { + std::string binString((char*)binBuffer, resultingBinSize); + free(binBuffer); + + if (!transactionBody.ParseFromString(binString)) { + addError(new Error("ProcessingTransaction", "error creating Transaction from binary Message")); + } else { + decoded = true; + } + } + } + } + /* + char *sodium_bin2hex(char * const hex, const size_t hex_maxlen, + const unsigned char * const bin, const size_t bin_len); + */ +%><%@ include file="header_old.cpsp" %> +
+

Transaktion dekodieren

+ <%= getErrorsHtml() %> +
+
+ Transaktion dekodieren + +
+ +
+ <% if(decoded) { %> +

Verwendungszweck:

+

<%= transactionBody.memo() %>

+ <% if(transactionBody.has_transfer()) { + auto transfer = transactionBody.transfer(); + %> +

Transfer

+ Sender + <% for(int i = 0; i < transfer.senderamounts_size(); i++) { + auto sender = transfer.senderamounts(i); + char hex[65]; memset(hex, 0, 65); + sodium_bin2hex(hex, 65, (const unsigned char*)sender.ed25519_sender_pubkey().data(), sender.ed25519_sender_pubkey().size()); + %> +

pubkey: <%= hex %>

+

amount: <%= sender.amount() %>

+ <% } %> + Receiver + <% for(int i = 0; i < transfer.receiveramounts_size(); i++) { + auto receiver = transfer.receiveramounts(i); + char hex[65]; memset(hex, 0, 65); + sodium_bin2hex(hex, 65, (const unsigned char*)receiver.ed25519_receiver_pubkey().data(), receiver.ed25519_receiver_pubkey().size()); + %> +

pubkey: <%= hex %>

+

amount: <%= receiver.amount() %>

+ <% } %> + <% } else if(transactionBody.has_creation()) { %> +

Creation

+ <% } %> + <% } %> +
+<%@ include file="footer.cpsp" %> \ No newline at end of file diff --git a/src/cpsp/footer_ripple.cpsp b/src/cpsp/footer_ripple.cpsp index 8b8dadf0a..f1e763fe9 100644 --- a/src/cpsp/footer_ripple.cpsp +++ b/src/cpsp/footer_ripple.cpsp @@ -6,8 +6,8 @@