diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php
index 4b81b8ac9..271265257 100644
--- a/community_server/src/Controller/AppRequestsController.php
+++ b/community_server/src/Controller/AppRequestsController.php
@@ -333,6 +333,7 @@ class AppRequestsController extends AppController
$this->addAdminError('StateBalancesController', 'overview', $gdtEntries, $user['id'] ? $user['id'] : 0);
}
+ //echo "count: $count, page: $page
";
$limit = $count;
$offset = 0;
$skip_first_transaction = false;
@@ -341,16 +342,15 @@ class AppRequestsController extends AppController
} else {
$offset = (( $page - 1 ) * $count) - 1;
}
- if($offset && $orderDirection == 'ASC') {
- // move cursor one step backwards to able to load one transaction previous last which will be shown for decay calculation
- $offset--;
- $limit++;
- $skip_first_transaction = true;
- } else if($orderDirection == 'DESC') {
+ if($offset) {
$limit++;
$skip_first_transaction = true;
+ if($orderDirection == 'ASC') {
+ $offset--;
+ }
}
+ //echo "limit: $limit, offset: $offset, skip first transaction: $skip_first_transaction
";
$stateUserTransactionsQuery = $stateUserTransactionsTable
->find()
->where(['state_user_id' => $user['id']])
@@ -373,7 +373,7 @@ class AppRequestsController extends AppController
}
$transactions = $transactionsTable->listTransactionsHumanReadable($transactions_from_db, $user, $decay, $skip_first_transaction);
-
+ //echo "transactions count: " . count($transactions) . "
";
if($orderDirection == 'DESC') {
$transactions = array_reverse($transactions);
}
diff --git a/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp b/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp
index c9e8b17e9..f278c393f 100644
--- a/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp
+++ b/login_server/src/cpp/JSONInterface/JsonSendEmail.cpp
@@ -115,7 +115,7 @@ Poco::JSON::Object* JsonSendEmail::handle(Poco::Dynamic::Var params)
return stateWarning("email already sended");
}
else if (2 == r) {
- return stateError("email already send less than a hour before");
+ return stateError("email already sent less than a 10 minutes before");
}
}
else if (emailType == model::EMAIL_CUSTOM_TEXT) {
diff --git a/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp b/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp
index 065520b0a..d2ed2af1a 100644
--- a/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp
+++ b/login_server/src/cpp/SingletonManager/PendingTasksManager.cpp
@@ -163,6 +163,10 @@ std::vector> PendingTasksManager::getTran
Poco::ScopedLock _lock(mWorkMutex);
std::vector> transactions_to_sign;
+ if (user->getModel()->getRole() != model::table::ROLE_ADMIN) {
+ return transactions_to_sign;
+ }
+
for (auto map_it = mPendingTasks.begin(); map_it != mPendingTasks.end(); map_it++)
{
auto list = map_it->second;
diff --git a/login_server/src/cpp/lib/JsonRequest.cpp b/login_server/src/cpp/lib/JsonRequest.cpp
index 411ec07a0..09bbffb1e 100644
--- a/login_server/src/cpp/lib/JsonRequest.cpp
+++ b/login_server/src/cpp/lib/JsonRequest.cpp
@@ -36,6 +36,10 @@ JsonRequestReturn JsonRequest::request(const char* methodName, const Poco::JSON:
// send post request via https
// 443 = HTTPS Default
// TODO: adding port into ServerConfig
+ if (mServerHost.empty() || !mServerPort) {
+ addError(new Error(functionName, "server host or server port not given"));
+ return JSON_REQUEST_PARAMETER_ERROR;
+ }
try {
Profiler phpRequestTime;
diff --git a/login_server/src/cpp/lib/JsonRequest.h b/login_server/src/cpp/lib/JsonRequest.h
index cfb9055d5..43b60ca40 100644
--- a/login_server/src/cpp/lib/JsonRequest.h
+++ b/login_server/src/cpp/lib/JsonRequest.h
@@ -20,6 +20,7 @@ enum JsonRequestReturn
JSON_REQUEST_RETURN_OK,
JSON_REQUEST_RETURN_PARSE_ERROR,
JSON_REQUEST_RETURN_ERROR,
+ JSON_REQUEST_PARAMETER_ERROR,
JSON_REQUEST_CONNECT_ERROR
};
diff --git a/login_server/src/cpp/model/Session.cpp b/login_server/src/cpp/model/Session.cpp
index 42b7202fd..a692dc463 100644
--- a/login_server/src/cpp/model/Session.cpp
+++ b/login_server/src/cpp/model/Session.cpp
@@ -425,7 +425,7 @@ int Session::sendResetPasswordEmail(Poco::AutoPtr user, bool p
auto email_verification_model = mEmailVerificationCodeObject->getModel();
if (email_already_send) {
auto time_elapsed = Poco::DateTime() - email_verification_model->getUpdated();
- if (time_elapsed.totalHours() < 1) {
+ if (time_elapsed.totalMinutes() < 10) {
frequent_resend = true;
}
}
diff --git a/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp
new file mode 100644
index 000000000..2a51f8f2e
--- /dev/null
+++ b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.cpp
@@ -0,0 +1,51 @@
+#include "TestJsonCreateTransaction.h"
+
+#include "JSONInterface/JsonCreateTransaction.h"
+
+void TestJsonCreateTransaction::SetUp()
+{
+ auto sm = SessionManager::getInstance();
+ //sm->init();
+ mUserSession = sm->getNewSession();
+ auto user = controller::User::create();
+ user->load("Jeet_bb@gmail.com");
+ user->login("TestP4ssword&H");
+ mUserSession->setUser(user);
+}
+
+void TestJsonCreateTransaction::TearDown()
+{
+ auto sm = SessionManager::getInstance();
+ if (!mUserSession) {
+ sm->releaseSession(mUserSession);
+ }
+}
+
+
+Poco::JSON::Object::Ptr TestJsonCreateTransaction::basisSetup()
+{
+ Poco::JSON::Object::Ptr params = new Poco::JSON::Object;
+ params->set("session_id", mUserSession->getHandle());
+ params->set("blockchain_type", "mysql");
+ params->set("memo", "Placolder for memo for test");
+ params->set("auto_sign", true);
+
+ return params;
+}
+
+TEST_F(TestJsonCreateTransaction, Creation)
+{
+ JsonCreateTransaction jsonCall;
+
+ auto params = basisSetup();
+ params->set("transaction_type", "creation");
+ params->set("target_email", "Elfenhausen@arcor.de");
+ params->set("amount", 10000000);
+ params->set("target_date", "2021-07-13T13:00:00");
+
+ auto result = jsonCall.handle(params);
+ std::stringstream ss;
+ result->stringify(ss);
+ printf("result: %s\n", ss.str().data());
+ //*/
+}
\ No newline at end of file
diff --git a/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h
new file mode 100644
index 000000000..53a3202f4
--- /dev/null
+++ b/login_server/src/cpp/test/JSONInterface/TestJsonCreateTransaction.h
@@ -0,0 +1,23 @@
+#ifndef __GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
+#define __GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
+
+#include "gtest/gtest.h"
+#include "SingletonManager/SessionManager.h"
+
+#include "Poco/JSON/Object.h"
+
+class TestJsonCreateTransaction : public ::testing::Test
+{
+
+protected:
+ void SetUp() override;
+ void TearDown() override;
+
+ Poco::JSON::Object::Ptr basisSetup();
+
+ Session* mUserSession;
+ std::string mEmail;
+
+};
+
+#endif //__GRADIDO_LOGIN_SERVER_TEST_JSON_INTERFACE_TEST_JSON_CREATE_TRANSACTION_H
\ No newline at end of file