diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1d2aef77e..08e03c5b7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -5,21 +5,5 @@ labels: bug title: 🐛 [Bug] --- -## :bug: Bugreport - - -### Steps to reproduce the behavior -1. -2. -3. -4. ... -5. Profit - -### Expected behavior - - -### Version & Environment - - -### Additional context - +## 🐛 Bugreport + - -### Motive - - -### Related issues - - -### Implementation - - -### Validation - - -### Additional context - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index ef3b30be2..94e5e5d80 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -5,20 +5,5 @@ labels: feature title: 🚀 [Feature] --- -## :rocket: Feature +## 🚀 Feature - -### User Problem - - -### Implementation - - -### Design & Layout - - -### Validation - - -### Additional context - diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index ef10a53ef..886faae20 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,11 +1,11 @@ --- name: 💬 Question -about: If you need help understanding HumanConnection. +about: If you need help understanding Gradido. labels: question title: 💬 [Question] --- -## :speech_balloon: Question +## 💬 Question diff --git a/.github/ISSUE_TEMPLATE/refactor_tickets.md b/.github/ISSUE_TEMPLATE/refactor_tickets.md index b595abd5d..969595dee 100644 --- a/.github/ISSUE_TEMPLATE/refactor_tickets.md +++ b/.github/ISSUE_TEMPLATE/refactor_tickets.md @@ -5,17 +5,5 @@ labels: refactor title: 🔧 [Refactor] --- -## :zap: Refactor ticket +## 🔧 Refactor ticket - -### Motive - - -### Related issues - - -### Implementation - - -### Additional context - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d854c88f..320a9cfea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -212,7 +212,7 @@ jobs: report_name: Coverage Frontend type: lcov result_path: ./coverage/lcov.info - min_coverage: 12 + min_coverage: 15 token: ${{ github.token }} #test: diff --git a/community_server/db/address_types.sql b/community_server/db/address_types.sql deleted file mode 100644 index 27f6bb410..000000000 --- a/community_server/db/address_types.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE `address_types` ( - `id` INT NOT NULL AUTO_INCREMENT, - `name` VARCHAR(25) NOT NULL, - `text` VARCHAR(255) NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; \ No newline at end of file diff --git a/community_server/db/operators.sql b/community_server/db/operators.sql deleted file mode 100644 index 8ffa9f04f..000000000 --- a/community_server/db/operators.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `operators` ( - `id` INT NOT NULL AUTO_INCREMENT , - `username` VARCHAR(128) NOT NULL , - `data_base64` VARCHAR(255) NOT NULL , - PRIMARY KEY (`id`), UNIQUE (`username`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - diff --git a/community_server/skeema/gradido_community/insert/address_types.sql b/community_server/db/setup_db_tables/address_types.sql similarity index 100% rename from community_server/skeema/gradido_community/insert/address_types.sql rename to community_server/db/setup_db_tables/address_types.sql diff --git a/community_server/skeema/gradido_community/insert/insert_blockchain_types.sql b/community_server/db/setup_db_tables/insert_blockchain_types.sql similarity index 100% rename from community_server/skeema/gradido_community/insert/insert_blockchain_types.sql rename to community_server/db/setup_db_tables/insert_blockchain_types.sql diff --git a/community_server/skeema/gradido_community/insert/insert_transaction_types.sql b/community_server/db/setup_db_tables/insert_transaction_types.sql similarity index 100% rename from community_server/skeema/gradido_community/insert/insert_transaction_types.sql rename to community_server/db/setup_db_tables/insert_transaction_types.sql diff --git a/community_server/skeema/gradido_community/address_types.sql b/community_server/db/skeema/gradido_community/address_types.sql similarity index 100% rename from community_server/skeema/gradido_community/address_types.sql rename to community_server/db/skeema/gradido_community/address_types.sql diff --git a/community_server/skeema/gradido_community/admin_errors.sql b/community_server/db/skeema/gradido_community/admin_errors.sql similarity index 100% rename from community_server/skeema/gradido_community/admin_errors.sql rename to community_server/db/skeema/gradido_community/admin_errors.sql diff --git a/community_server/skeema/gradido_community/blockchain_types.sql b/community_server/db/skeema/gradido_community/blockchain_types.sql similarity index 100% rename from community_server/skeema/gradido_community/blockchain_types.sql rename to community_server/db/skeema/gradido_community/blockchain_types.sql diff --git a/community_server/skeema/gradido_community/community_profiles.sql b/community_server/db/skeema/gradido_community/community_profiles.sql similarity index 100% rename from community_server/skeema/gradido_community/community_profiles.sql rename to community_server/db/skeema/gradido_community/community_profiles.sql diff --git a/community_server/skeema/gradido_community/operator_types.sql b/community_server/db/skeema/gradido_community/operator_types.sql similarity index 100% rename from community_server/skeema/gradido_community/operator_types.sql rename to community_server/db/skeema/gradido_community/operator_types.sql diff --git a/community_server/skeema/gradido_community/operators.sql b/community_server/db/skeema/gradido_community/operators.sql similarity index 100% rename from community_server/skeema/gradido_community/operators.sql rename to community_server/db/skeema/gradido_community/operators.sql diff --git a/community_server/skeema/gradido_community/pending_transactions.sql b/community_server/db/skeema/gradido_community/pending_transactions.sql similarity index 100% rename from community_server/skeema/gradido_community/pending_transactions.sql rename to community_server/db/skeema/gradido_community/pending_transactions.sql diff --git a/community_server/skeema/gradido_community/roles.sql b/community_server/db/skeema/gradido_community/roles.sql similarity index 100% rename from community_server/skeema/gradido_community/roles.sql rename to community_server/db/skeema/gradido_community/roles.sql diff --git a/community_server/skeema/gradido_community/server_users.sql b/community_server/db/skeema/gradido_community/server_users.sql similarity index 100% rename from community_server/skeema/gradido_community/server_users.sql rename to community_server/db/skeema/gradido_community/server_users.sql diff --git a/community_server/skeema/gradido_community/state_balances.sql b/community_server/db/skeema/gradido_community/state_balances.sql similarity index 100% rename from community_server/skeema/gradido_community/state_balances.sql rename to community_server/db/skeema/gradido_community/state_balances.sql diff --git a/community_server/skeema/gradido_community/state_created.sql b/community_server/db/skeema/gradido_community/state_created.sql similarity index 100% rename from community_server/skeema/gradido_community/state_created.sql rename to community_server/db/skeema/gradido_community/state_created.sql diff --git a/community_server/skeema/gradido_community/state_errors.sql b/community_server/db/skeema/gradido_community/state_errors.sql similarity index 100% rename from community_server/skeema/gradido_community/state_errors.sql rename to community_server/db/skeema/gradido_community/state_errors.sql diff --git a/community_server/skeema/gradido_community/state_group_addresses.sql b/community_server/db/skeema/gradido_community/state_group_addresses.sql similarity index 100% rename from community_server/skeema/gradido_community/state_group_addresses.sql rename to community_server/db/skeema/gradido_community/state_group_addresses.sql diff --git a/community_server/skeema/gradido_community/state_group_relationships.sql b/community_server/db/skeema/gradido_community/state_group_relationships.sql similarity index 100% rename from community_server/skeema/gradido_community/state_group_relationships.sql rename to community_server/db/skeema/gradido_community/state_group_relationships.sql diff --git a/community_server/skeema/gradido_community/state_groups.sql b/community_server/db/skeema/gradido_community/state_groups.sql similarity index 100% rename from community_server/skeema/gradido_community/state_groups.sql rename to community_server/db/skeema/gradido_community/state_groups.sql diff --git a/community_server/skeema/gradido_community/state_relationship_types.sql b/community_server/db/skeema/gradido_community/state_relationship_types.sql similarity index 100% rename from community_server/skeema/gradido_community/state_relationship_types.sql rename to community_server/db/skeema/gradido_community/state_relationship_types.sql diff --git a/community_server/skeema/gradido_community/state_user_roles.sql b/community_server/db/skeema/gradido_community/state_user_roles.sql similarity index 100% rename from community_server/skeema/gradido_community/state_user_roles.sql rename to community_server/db/skeema/gradido_community/state_user_roles.sql diff --git a/community_server/skeema/gradido_community/state_user_transactions.sql b/community_server/db/skeema/gradido_community/state_user_transactions.sql similarity index 100% rename from community_server/skeema/gradido_community/state_user_transactions.sql rename to community_server/db/skeema/gradido_community/state_user_transactions.sql diff --git a/community_server/skeema/gradido_community/state_users.sql b/community_server/db/skeema/gradido_community/state_users.sql similarity index 100% rename from community_server/skeema/gradido_community/state_users.sql rename to community_server/db/skeema/gradido_community/state_users.sql diff --git a/community_server/skeema/gradido_community/transaction_creations.sql b/community_server/db/skeema/gradido_community/transaction_creations.sql similarity index 90% rename from community_server/skeema/gradido_community/transaction_creations.sql rename to community_server/db/skeema/gradido_community/transaction_creations.sql index a2ff37539..8612c764a 100644 --- a/community_server/skeema/gradido_community/transaction_creations.sql +++ b/community_server/db/skeema/gradido_community/transaction_creations.sql @@ -3,7 +3,7 @@ CREATE TABLE `transaction_creations` ( `transaction_id` int(10) unsigned NOT NULL, `state_user_id` int(10) unsigned NOT NULL, `amount` bigint(20) NOT NULL, - `ident_hash` binary(32) NOT NULL, + `ident_hash` binary(32) NULL, `target_date` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/community_server/skeema/gradido_community/transaction_group_addaddress.sql b/community_server/db/skeema/gradido_community/transaction_group_addaddress.sql similarity index 100% rename from community_server/skeema/gradido_community/transaction_group_addaddress.sql rename to community_server/db/skeema/gradido_community/transaction_group_addaddress.sql diff --git a/community_server/skeema/gradido_community/transaction_group_allowtrades.sql b/community_server/db/skeema/gradido_community/transaction_group_allowtrades.sql similarity index 100% rename from community_server/skeema/gradido_community/transaction_group_allowtrades.sql rename to community_server/db/skeema/gradido_community/transaction_group_allowtrades.sql diff --git a/community_server/skeema/gradido_community/transaction_group_creates.sql b/community_server/db/skeema/gradido_community/transaction_group_creates.sql similarity index 100% rename from community_server/skeema/gradido_community/transaction_group_creates.sql rename to community_server/db/skeema/gradido_community/transaction_group_creates.sql diff --git a/community_server/skeema/gradido_community/transaction_send_coins.sql b/community_server/db/skeema/gradido_community/transaction_send_coins.sql similarity index 100% rename from community_server/skeema/gradido_community/transaction_send_coins.sql rename to community_server/db/skeema/gradido_community/transaction_send_coins.sql diff --git a/community_server/skeema/gradido_community/transaction_signatures.sql b/community_server/db/skeema/gradido_community/transaction_signatures.sql similarity index 100% rename from community_server/skeema/gradido_community/transaction_signatures.sql rename to community_server/db/skeema/gradido_community/transaction_signatures.sql diff --git a/community_server/skeema/gradido_community/transaction_types.sql b/community_server/db/skeema/gradido_community/transaction_types.sql similarity index 100% rename from community_server/skeema/gradido_community/transaction_types.sql rename to community_server/db/skeema/gradido_community/transaction_types.sql diff --git a/community_server/skeema/gradido_community/transactions.sql b/community_server/db/skeema/gradido_community/transactions.sql similarity index 100% rename from community_server/skeema/gradido_community/transactions.sql rename to community_server/db/skeema/gradido_community/transactions.sql diff --git a/community_server/db/state_balances.sql b/community_server/db/state_balances.sql deleted file mode 100644 index 0bc263093..000000000 --- a/community_server/db/state_balances.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `state_balances` ( - `id` int(11) NOT NULL, - `state_user_id` int(11) NOT NULL, - `modified` datetime NOT NULL, - `amount` bigint(20) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; \ No newline at end of file diff --git a/community_server/db/state_created.sql b/community_server/db/state_created.sql deleted file mode 100644 index a15ccacd3..000000000 --- a/community_server/db/state_created.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `state_created` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `month` tinyint(4) NOT NULL, - `year` smallint(6) NOT NULL, - `state_user_id` int(11) NOT NULL, - `created` datetime NOT NULL, - `short_ident_hash` int(11) NOT NULL, - PRIMARY KEY (`id`), INDEX(`short_ident_hash`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/state_group_addresses.sql b/community_server/db/state_group_addresses.sql deleted file mode 100644 index 3e09b8658..000000000 --- a/community_server/db/state_group_addresses.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `state_group_addresses` ( - `id` int(11) NOT NULL, - `state_group_id` int(11) NOT NULL, - `public_key` binary(32) NOT NULL, - `address_type_id` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/state_group_relationships.sql b/community_server/db/state_group_relationships.sql deleted file mode 100644 index 0d26e91b6..000000000 --- a/community_server/db/state_group_relationships.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `state_group_relationships` ( - `id` int(11) NOT NULL, - `state_group1_id` int(11) NOT NULL, - `state_group2_id` int(11) NOT NULL, - `state_relationship_id` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/state_groups.sql b/community_server/db/state_groups.sql deleted file mode 100644 index dc5ca5251..000000000 --- a/community_server/db/state_groups.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `state_groups` ( - `id` INT NOT NULL AUTO_INCREMENT, - `index_id` VARBINARY(64) NOT NULL, - `name` VARCHAR(50) NOT NULL, - `root_public_key` BINARY(32) NOT NULL, - `user_count` SMALLINT NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; \ No newline at end of file diff --git a/community_server/db/state_relationship_types.sql b/community_server/db/state_relationship_types.sql deleted file mode 100644 index d6e53a966..000000000 --- a/community_server/db/state_relationship_types.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE `state_relationship_types` ( - `id` int(11) NOT NULL, - `name` varchar(25) COLLATE utf8_bin NOT NULL, - `text` varchar(255) COLLATE utf8_bin DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/state_users.sql b/community_server/db/state_users.sql deleted file mode 100644 index 82d61f10e..000000000 --- a/community_server/db/state_users.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `state_users` ( - `id` int(11) NOT NULL, - `index_id` smallint(6) NOT NULL, - `state_group_id` int(11) NOT NULL, - `public_key` binary(32) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/transaction_creations.sql b/community_server/db/transaction_creations.sql deleted file mode 100644 index 343404ddb..000000000 --- a/community_server/db/transaction_creations.sql +++ /dev/null @@ -1,10 +0,0 @@ - -CREATE TABLE `transaction_creations` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `state_user_id` int(11) NOT NULL, - `amount` bigint(20) NOT NULL, - `ident_hash` binary(32) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - diff --git a/community_server/db/transaction_group_addAddress.sql b/community_server/db/transaction_group_addAddress.sql deleted file mode 100644 index f7474cc73..000000000 --- a/community_server/db/transaction_group_addAddress.sql +++ /dev/null @@ -1,8 +0,0 @@ - -CREATE TABLE `transaction_group_addaddress` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `address_type_id` int(11) NOT NULL, - `public_key` binary(32) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/transaction_group_allowtrades.sql b/community_server/db/transaction_group_allowtrades.sql deleted file mode 100644 index 2fd94b4d6..000000000 --- a/community_server/db/transaction_group_allowtrades.sql +++ /dev/null @@ -1,8 +0,0 @@ - -CREATE TABLE `transaction_group_allowtrades` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `group_id` int(11) NOT NULL, - `allow` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/transaction_group_creates.sql b/community_server/db/transaction_group_creates.sql deleted file mode 100644 index 0c0d7cc5d..000000000 --- a/community_server/db/transaction_group_creates.sql +++ /dev/null @@ -1,9 +0,0 @@ - -CREATE TABLE `transaction_group_creates` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `group_public_key` binary(32) NOT NULL, - `state_group_id` int(11) COLLATE utf8_bin NOT NULL, - `name` varchar(64) COLLATE utf8_bin NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/transaction_send_coins.sql b/community_server/db/transaction_send_coins.sql deleted file mode 100644 index 8113c78e0..000000000 --- a/community_server/db/transaction_send_coins.sql +++ /dev/null @@ -1,11 +0,0 @@ - -CREATE TABLE `transaction_send_coins` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `state_user_id` int(11) NOT NULL, - `receiver_public_key` binary(32) NOT NULL, - `receiver_user_id` varbinary(64) NOT NULL, - `amount` bigint(20) NOT NULL, - `sender_final_balance` bigint(20) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/transaction_signatures.sql b/community_server/db/transaction_signatures.sql deleted file mode 100644 index 9fab87fb2..000000000 --- a/community_server/db/transaction_signatures.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `transaction_signatures` ( - `id` int(11) NOT NULL, - `transaction_id` int(11) NOT NULL, - `signature` binary(64) NOT NULL, - `pubkey` binary(32) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/db/transaction_types.sql b/community_server/db/transaction_types.sql deleted file mode 100644 index 26bd70c52..000000000 --- a/community_server/db/transaction_types.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE `transaction_types` ( - `id` INT NOT NULL AUTO_INCREMENT, - `name` VARCHAR(24) NOT NULL, - `text` VARCHAR(255) NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; \ No newline at end of file diff --git a/community_server/db/transactions.sql b/community_server/db/transactions.sql deleted file mode 100644 index e664b067f..000000000 --- a/community_server/db/transactions.sql +++ /dev/null @@ -1,9 +0,0 @@ - -CREATE TABLE `transactions` ( - `id` bigint(20) NOT NULL, - `state_group_id` int(11) NOT NULL, - `transaction_type_id` int(11) NOT NULL, - `tx_hash` binary(32) NOT NULL, - `received` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/community_server/src/Controller/AppController.php b/community_server/src/Controller/AppController.php index 98a690bd1..1cdcf4418 100644 --- a/community_server/src/Controller/AppController.php +++ b/community_server/src/Controller/AppController.php @@ -167,13 +167,15 @@ class AppController extends Controller $php_session_id = intval($session->read('session_id')); } $cookie_session_id = intval($this->request->getCookie('GRADIDO_LOGIN', '')); - if($php_session_id != 0) { + // decide in which order session_ids are tried + if($sessionId != 0) { + $session_id = $sessionId; + } else if($php_session_id != 0) { $session_id = $php_session_id; } else if($cookie_session_id != 0) { $session_id = $cookie_session_id; - } else { - $session_id = $sessionId; - } + } + $ip = $this->request->clientIp(); if (!$session->check('client_ip')) { $session->write('client_ip', $ip); diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index 37dd04d92..dfc11d4a2 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -61,8 +61,8 @@ class AppRequestsController extends AppController if(is_array($field)) { $one_exist = false; foreach($field as $oneField) { - if(isset($data[$oneField])) { - $param[$oneField] = $data[$oneField]; + if(isset($data->$oneField)) { + $param[$oneField] = $data->$oneField; $one_exist = true; break; } @@ -71,10 +71,10 @@ class AppRequestsController extends AppController return ['state' => 'error', 'msg' => 'missing field of set', 'details' => $field]; } } else { - if(!isset($data[$field])) { + if(!isset($data->$field)) { return ['state' => 'error', 'msg' => 'missing field', 'details' => $field . ' not found']; } else { - $param[$field] = $data[$field]; + $param[$field] = $data->$field; } } } @@ -85,9 +85,9 @@ class AppRequestsController extends AppController { foreach(array_keys($replaceKeys) as $key) { $newKey = $replaceKeys[$key]; - if(isset($data[$key])) { - $data[$newKey] = $data[$key]; - unset($data[$key]); + if(isset($data->$key)) { + $data->$newKey = $data->$key; + unset($data->$key); } } } @@ -98,8 +98,8 @@ class AppRequestsController extends AppController $data = $this->request->input('json_decode'); } $session_id = 0; - if(isset($data['session_id'])) { - $session_id = $data['session_id']; + if(isset($data->session_id)) { + $session_id = $data->session_id; } $login_request_result = $this->requestLogin($session_id, false); if($login_request_result !== true) { @@ -119,12 +119,12 @@ class AppRequestsController extends AppController return ['state' => 'error', 'msg' => 'amount is invalid', 'details' => $param['amount']]; } - if(isset($data['memo'])) { - $param['memo'] = $data['memo']; + if(isset($data->memo)) { + $param['memo'] = $data->memo; } - if(isset($data['auto_sign'])) { - $param['auto_sign'] = boolval($data['auto_sign']); + if(isset($data->auto_sign)) { + $param['auto_sign'] = boolval($data->auto_sign); } return true; @@ -317,7 +317,6 @@ class AppRequestsController extends AppController $gdtSum = intval($gdtEntries['data']['sum']); } else { $this->addAdminError('StateBalancesController', 'overview', $gdtEntries, $user['id'] ? $user['id'] : 0); - } } @@ -330,11 +329,13 @@ class AppRequestsController extends AppController ->page($page) ; $decay = true; - $transactions = $transactionsTable->listTransactionsHumanReadable($stateUserTransactionsQuery->toArray(), $user, $decay); + $transactions = []; + if($stateUserTransactionsQuery->count() > 0) { + $transactions = $transactionsTable->listTransactionsHumanReadable($stateUserTransactionsQuery->toArray(), $user, $decay); - - if($orderDirection == 'DESC') { - $transactions = array_reverse($transactions); + if($orderDirection == 'DESC') { + $transactions = array_reverse($transactions); + } } return $this->returnJson([ 'state' => 'success', diff --git a/community_server/src/Model/Table/StateBalancesTable.php b/community_server/src/Model/Table/StateBalancesTable.php index 0878f5a23..7564c30f2 100644 --- a/community_server/src/Model/Table/StateBalancesTable.php +++ b/community_server/src/Model/Table/StateBalancesTable.php @@ -180,7 +180,7 @@ class StateBalancesTable extends Table $transactions = $transactionsTable ->find('all') - ->where(['id IN' => array_keys($transaction_ids)]) + ->where(['Transactions.id IN' => array_keys($transaction_ids)]) ->contain(['TransactionCreations', 'TransactionSendCoins']); $transactions_indiced = []; @@ -199,7 +199,7 @@ class StateBalancesTable extends Table $amount = 0; if($transaction->transaction_type_id == 1) { // creation - $temp = $transaction->transaction_creations[0]; + $temp = $transaction->transaction_creation; /*$balance_temp = $this->newEntity(); $balance_temp->amount = $temp->amount; @@ -211,7 +211,7 @@ class StateBalancesTable extends Table //$amount_date = } else if($transaction->transaction_type_id == 2) { // transfer - $temp = $transaction->transaction_send_coins[0]; + $temp = $transaction->transaction_send_coin; $amount = intval($temp->amount); // reverse if sender if($stateUserId == $temp->state_user_id) { diff --git a/configs/community_server/app.php b/configs/community_server/app.php index ee2244636..f0cf46220 100644 --- a/configs/community_server/app.php +++ b/configs/community_server/app.php @@ -427,6 +427,6 @@ return [ ], 'ServerAdminEmail' => 'info@gradido.net', 'noReplyEmail' => 'no-reply@gradido.net', - 'disableEmail' => false + 'disableEmail' => true ]; diff --git a/configs/login_server/grd_login.properties b/configs/login_server/grd_login.properties index 47dc81229..f14568a16 100644 --- a/configs/login_server/grd_login.properties +++ b/configs/login_server/grd_login.properties @@ -22,7 +22,7 @@ loginServer.db.user = root loginServer.db.password = loginServer.db.port = 3306 -frontend.checkEmailPath = http://localhost/account/checkEmail +frontend.checkEmailPath = http://localhost/reset email.disable = true diff --git a/configs/login_server/setup_db_tables/setup_docker_group.sql b/configs/login_server/setup_db_tables/setup_docker_group.sql new file mode 100644 index 000000000..5f1b64c3f --- /dev/null +++ b/configs/login_server/setup_db_tables/setup_docker_group.sql @@ -0,0 +1,6 @@ +INSERT INTO `groups` (`id`, `alias`, `name`, `url`, `host`, `home`, `description`) VALUES +(1, 'docker', 'docker gradido group', 'localhost', 'nginx', '/', 'gradido test group for docker and stage2 with blockchain db'); + + + + diff --git a/login_server/skeema/gradido_login/insert/setup_hedera_group.sql b/configs/login_server/setup_db_tables/setup_hedera_group.sql similarity index 74% rename from login_server/skeema/gradido_login/insert/setup_hedera_group.sql rename to configs/login_server/setup_db_tables/setup_hedera_group.sql index 8dd601b97..2ae4dfeb6 100644 --- a/login_server/skeema/gradido_login/insert/setup_hedera_group.sql +++ b/configs/login_server/setup_db_tables/setup_hedera_group.sql @@ -1,19 +1,19 @@ -INSERT INTO `groups` (`id`, `alias`, `name`, `url`, `home`, `description`) VALUES -(1, 'dockerStage2', 'docker stage2 gradido group', 'localhost', '/', 'gradido test group for docker and stage2'); - -INSERT INTO `hedera_ids` (`id`, `shardNum`, `realmNum`, `num`) VALUES -(1, 0, 0, 3), -(2, 0, 0, 3327), -(3, 0, 0, 413151); - -INSERT INTO `node_servers` (`id`, `url`, `port`, `group_id`, `server_type`, `node_hedera_id`, `last_live_sign`) VALUES -(1, 'http://0.testnet.hedera.com', 50211, 0, 4, 1, '2000-01-01 00:00:00'); - -INSERT INTO `hedera_accounts` (`id`, `user_id`, `account_hedera_id`, `account_key_id`, `balance`, `network_type`, `updated`) VALUES -(1, 1, 2, 1, 1000000000000, 1, '2021-01-07 10:22:52'); - -INSERT INTO `hedera_topics` (`id`, `topic_hedera_id`, `name`, `auto_renew_account_hedera_id`, `auto_renew_period`, `group_id`, `admin_key_id`, `submit_key_id`, `current_timeout`, `sequence_number`, `running_hash`, `running_hash_version`, `updated`) VALUES -(1, 3, 'dockerStage2', 1, 7890000, 1, 0, 0, '2021-06-08 23:17:19', 0, NULL, 0, '2021-03-09 16:42:34'); - - - +INSERT INTO `groups` (`id`, `alias`, `name`, `url`, `host`, `home`, `description`) VALUES +(2, 'dockerStage2', 'docker stage2 gradido group', 'localhost', 'nginx', '/', 'gradido test group for docker and stage2'); + +INSERT INTO `hedera_ids` (`id`, `shardNum`, `realmNum`, `num`) VALUES +(1, 0, 0, 3), +(2, 0, 0, 3327), +(3, 0, 0, 413151); + +INSERT INTO `node_servers` (`id`, `url`, `port`, `group_id`, `server_type`, `node_hedera_id`, `last_live_sign`) VALUES +(1, 'http://0.testnet.hedera.com', 50211, 0, 4, 2, '2000-01-01 00:00:00'); + +INSERT INTO `hedera_accounts` (`id`, `user_id`, `account_hedera_id`, `account_key_id`, `balance`, `network_type`, `updated`) VALUES +(1, 1, 2, 1, 1000000000000, 1, '2021-01-07 10:22:52'); + +INSERT INTO `hedera_topics` (`id`, `topic_hedera_id`, `name`, `auto_renew_account_hedera_id`, `auto_renew_period`, `group_id`, `admin_key_id`, `submit_key_id`, `current_timeout`, `sequence_number`, `running_hash`, `running_hash_version`, `updated`) VALUES +(1, 3, 'dockerStage2', 1, 7890000, 1, 0, 0, '2021-06-08 23:17:19', 0, NULL, 0, '2021-03-09 16:42:34'); + + + diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 20ee4dfd3..1311fe894 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -8,6 +8,8 @@ services: image: gradido/frontend:development build: target: development + networks: + - external-net environment: - NODE_ENV="development" # - DEBUG=true diff --git a/docker-compose.yml b/docker-compose.yml index 8b5bf33de..59e617d71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,13 +15,13 @@ services: context: ./frontend target: production networks: - - external-net + - internal-net ports: - - 8080:8080 + - 3000:3000 environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" - # - PORT="8080" + # - PORT=3000 - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT diff --git a/docu/community-server.api.md b/docu/community-server.api.md index a4b5c327d..1c95c74b3 100644 --- a/docu/community-server.api.md +++ b/docu/community-server.api.md @@ -150,6 +150,7 @@ with - `session_id`: optional, only used if cookie GRADIDO_LOGIN not exist and no sesion_id in php session - `email` or `username` or `pubkey`: used to identify how gets the gradidos (email and username are only aliases for pubkey) - `amount`: gdd amount to transfer in gradido cent (10000000 = 1000,00 GDD) +- `target_date`: target date for creation, can be max 3 months before current date, but not after current date, allowed formats do you find here: https://pocoproject.org/docs/Poco.DateTimeFormat.html - `memo`: text for receiver, currently saved as clear text in blockchain - `auto_sign`: if set to true, transaction will be directly signed on login-server and proceed if needed signs are there if set to false, transaction must be signed after on `http://localhost/account/checkTransactions` diff --git a/docu/login_server.api.md b/docu/login_server.api.md index 27d83c06a..70f19cdde 100644 --- a/docu/login_server.api.md +++ b/docu/login_server.api.md @@ -56,6 +56,7 @@ In case of success returns: "first_name": "Max", "group_alias": "gdd1", "ident_hash": 323769895, + "language":"de", "last_name": "Mustermann", "public_hex": "131c7f68dd94b2be4c913400ff7ff4cdc03ac2bda99c2d29edcacb3b065c67e6", "role": "none", @@ -74,6 +75,7 @@ In case of success returns: - `first_name`: first name of user - `group_alias`: alias of group/community to which user belong - `ident_hash`: currently hash of email, will be later a identification hash to prevent multiple accounts and therefore multiple creations per user + - `language`: language of user, currently only "de" or "en" - `last_name`: last name of user - `public_hex`: public key of user in hex format - `role`: role of user currently only "none" or "admin" @@ -302,6 +304,7 @@ In case of success returns: "first_name": "Max", "group_alias": "gdd1", "ident_hash": 323769895, + "language": "de", "last_name": "Mustermann", "public_hex": "131c7f68dd94b2be4c913400ff7ff4cdc03ac2bda99c2d29edcacb3b065c67e6", "role": "none", @@ -326,6 +329,7 @@ In case of success returns: - `first_name`: first name of user - `group_alias`: alias of group/community to which user belong - `ident_hash`: currently hash of email, will be later a identification hash to prevent multiple accounts and therefore multiple creations per user + - `language`: language of user, currently only "de" or "en" - `last_name`: last name of user - `public_hex`: public key of user in hex format - `role`: role of user currently only "none" or "admin" diff --git a/frontend/.env.dist b/frontend/.env.dist index 39edd4b4e..ffe4869fa 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,3 +1,3 @@ LOGIN_API_URL=http://localhost/login_api/ COMMUNITY_API_URL=http://localhost/api/ -VUE_PATH=/vue +ALLOW_REGISTER=true \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f133926b2..5ec90fe81 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -15,7 +15,7 @@ ENV BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs -ENV PORT="8080" +ENV PORT="3000" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" @@ -82,15 +82,14 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/dist ./dist -#COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules -#COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js +# We also copy the node_modules express and serve-static for the run script +COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules # Copy static files -# TODO - this should be one Folder containign all stuff needed to be copied -#COPY --from=build ${DOCKER_WORKDIR}/constants ./constants -#COPY --from=build ${DOCKER_WORKDIR}/static ./static -#COPY --from=build ${DOCKER_WORKDIR}/locales ./locales +COPY --from=build ${DOCKER_WORKDIR}/public ./public # Copy package.json for script definitions (lock file should not be needed) COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json +# Copy run scripts run/ +COPY --from=build ${DOCKER_WORKDIR}/run ./run # Run command CMD /bin/sh -c "yarn run start" diff --git a/frontend/package.json b/frontend/package.json index 00e0ca45b..a7f59eaa1 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.9.4", "private": true, "scripts": { - "start": "node server.js", + "start": "node run/server.js", "serve": "vue-cli-service serve --open", "build": "vue-cli-service build", "lint": "eslint --ext .js,.vue .", @@ -69,6 +69,7 @@ "vue-good-table": "^2.21.3", "vue-i18n": "^8.22.4", "vue-jest": "^3.0.7", + "vue-loading-overlay": "^3.4.2", "vue-moment": "^4.1.0", "vue-qrcode": "^0.3.5", "vue-qrcode-reader": "^2.3.16", diff --git a/frontend/run/server.js b/frontend/run/server.js new file mode 100644 index 000000000..470acdc4e --- /dev/null +++ b/frontend/run/server.js @@ -0,0 +1,14 @@ +// Imports +const express = require('express') +const serveStatic = require('serve-static') + +// Port +const port = process.env.PORT || 3000 + +// Express Server +const app = express() +app.use(serveStatic(__dirname + '/../dist')) +app.listen(port) + +// eslint-disable-next-line no-console +console.log(`http://frontend:${port} server started.`) diff --git a/frontend/server.js b/frontend/server.js deleted file mode 100644 index 5bcebd90a..000000000 --- a/frontend/server.js +++ /dev/null @@ -1,7 +0,0 @@ -var express = require('express') -var serveStatic = require('serve-static') -var app = express() -app.use(serveStatic(__dirname + '/dist')) -var port = process.env.PORT || 5000 -app.listen(port) -// console.log('http://localhost:5000 server started.'); diff --git a/frontend/src/apis/communityAPI.js b/frontend/src/apis/communityAPI.js index 4af1ea901..589794635 100644 --- a/frontend/src/apis/communityAPI.js +++ b/frontend/src/apis/communityAPI.js @@ -36,7 +36,7 @@ const communityAPI = { return apiGet(CONFIG.COMMUNITY_API_URL + 'getBalance/' + session_id) }, transactions: async (session_id) => { - return apiGet(CONFIG.COMMUNITY_API__URL + 'listTransactions/1/25/ASC/' + session_id) + return apiGet(CONFIG.COMMUNITY_API_URL + 'listTransactions/1/25/ASC/' + session_id) }, /*create: async (session_id, email, amount, memo, target_date = new Date() ) => { const payload = { @@ -49,15 +49,16 @@ const communityAPI = { } return apiPost(CONFIG.COMMUNITY_API__URL + 'createCoins/', payload) },*/ - send: async (session_id, email, amount, memo) => { + send: async (session_id, email, amount, memo, target_date) => { const payload = { session_id, email, amount, memo, + target_date, auto_sign: true, } - return apiPost(CONFIG.COMMUNITY_API__URL + 'sendCoins/', payload) + return apiPost(CONFIG.COMMUNITY_API_URL + 'sendCoins/', payload) }, } diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 91020ddbb..a31a4062e 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -64,7 +64,6 @@ const loginAPI = { return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload) }, sendEmail: async (email, email_text = 7, email_verification_code_type = 'resetPassword') => { - //console.log('api email', email) const payload = { email, email_text, @@ -72,6 +71,21 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'sendEmail', payload) }, + loginViaEmailVerificationCode: async (optin) => { + return apiGet( + CONFIG.LOGIN_API_URL + 'loginViaEmailVerificationCode?emailVerificationCode=' + optin, + ) + }, + changePassword: async (session_id, email, password) => { + const payload = { + session_id, + email, + update: { + 'User.password': password, + }, + } + return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) + }, } export default loginAPI diff --git a/frontend/src/components/SidebarPlugin/SideBar.vue b/frontend/src/components/SidebarPlugin/SideBar.vue index 42d1e5fb1..6542bd23e 100755 --- a/frontend/src/components/SidebarPlugin/SideBar.vue +++ b/frontend/src/components/SidebarPlugin/SideBar.vue @@ -10,7 +10,7 @@ ... - {{ $n($store.state.user.balance) }} GDD + {{ $n(balance) }} GDD