mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' of https://github.com/gradido/gradido
This commit is contained in:
commit
248c413173
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.log
|
*.log
|
||||||
/node_modules/*
|
/node_modules/*
|
||||||
|
.vscode
|
||||||
|
|||||||
41
CHANGELOG.md
41
CHANGELOG.md
@ -4,8 +4,49 @@ All notable changes to this project will be documented in this file. Dates are d
|
|||||||
|
|
||||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||||
|
|
||||||
|
#### [0.9.4](https://github.com/gradido/gradido/compare/0.9.3...0.9.4)
|
||||||
|
|
||||||
|
- Build on run [`#103`](https://github.com/gradido/gradido/pull/103)
|
||||||
|
- update debug docker to use dependencies container pushed to docker hub [`1f002f4`](https://github.com/gradido/gradido/commit/1f002f4ed0b12d4b2bf63efceabe546d0c5b58ea)
|
||||||
|
- removed email tasks complete [`8a143be`](https://github.com/gradido/gradido/commit/8a143be8423d7bd894d4f512848895df8b9694b0)
|
||||||
|
- build login-server on docker-compose up in a docker volume so it rebuild only neccessary parts if some c++ files have changed [`0da5279`](https://github.com/gradido/gradido/commit/0da527917523530186e6effe63dc001fc99bd3e3)
|
||||||
|
|
||||||
|
#### [0.9.3](https://github.com/gradido/gradido/compare/0.9.2...0.9.3)
|
||||||
|
|
||||||
|
> 30 March 2021
|
||||||
|
|
||||||
|
- new version 0.9.3 [`#110`](https://github.com/gradido/gradido/pull/110)
|
||||||
|
- feat: Frontend tests for Content Footer [`#102`](https://github.com/gradido/gradido/pull/102)
|
||||||
|
- add check session state json function and doc [`#96`](https://github.com/gradido/gradido/pull/96)
|
||||||
|
- activity page stap 2 [`#86`](https://github.com/gradido/gradido/pull/86)
|
||||||
|
- qrcode scanner fixed, datum in activitäten fixed, sprache not null fixed [`#88`](https://github.com/gradido/gradido/pull/88)
|
||||||
|
- add additional docker container which is running skeema on startup to… [`#83`](https://github.com/gradido/gradido/pull/83)
|
||||||
|
- New fix up frontend for presentation [`#85`](https://github.com/gradido/gradido/pull/85)
|
||||||
|
- feat: Tougher eslint rules [`#77`](https://github.com/gradido/gradido/pull/77)
|
||||||
|
- feat: improve translations [`#81`](https://github.com/gradido/gradido/pull/81)
|
||||||
|
- use_correct_send_api [`#80`](https://github.com/gradido/gradido/pull/80)
|
||||||
|
- fix bug with access rights [`#78`](https://github.com/gradido/gradido/pull/78)
|
||||||
|
- make response.html better accessible [`#75`](https://github.com/gradido/gradido/pull/75)
|
||||||
|
- feat: Lokalize Validation Messages [`#67`](https://github.com/gradido/gradido/pull/67)
|
||||||
|
- feat: Localize links to gradito.net [`#74`](https://github.com/gradido/gradido/pull/74)
|
||||||
|
- fix-padding [`#73`](https://github.com/gradido/gradido/pull/73)
|
||||||
|
- Correctly use transactions API in frontend [`#69`](https://github.com/gradido/gradido/pull/69)
|
||||||
|
- Qr code scanner [`#72`](https://github.com/gradido/gradido/pull/72)
|
||||||
|
- Login fail message [`#71`](https://github.com/gradido/gradido/pull/71)
|
||||||
|
- Setup unit tests for frontend [`#55`](https://github.com/gradido/gradido/pull/55)
|
||||||
|
- Update doc [`#63`](https://github.com/gradido/gradido/pull/63)
|
||||||
|
- Add Feature in user search old frontend because Support has requested the feature long ago [`#56`](https://github.com/gradido/gradido/pull/56)
|
||||||
|
- sprache angepasst, for login, pwd, sigin [`#54`](https://github.com/gradido/gradido/pull/54)
|
||||||
|
- Improve workflows [`#53`](https://github.com/gradido/gradido/pull/53)
|
||||||
|
- setup eslint with tougher rules [`1f13507`](https://github.com/gradido/gradido/commit/1f13507eacfd93c2248fb841de5f481c9eb1e6bd)
|
||||||
|
- semicolon rule implemented [`6762a02`](https://github.com/gradido/gradido/commit/6762a028f2a3e4f2713b26bed81029defe686ad7)
|
||||||
|
- dev meeting, bernd [`a99de7f`](https://github.com/gradido/gradido/commit/a99de7f5d1f7557c0877eae565aa4263d65aaaf3)
|
||||||
|
|
||||||
#### [0.9.2](https://github.com/gradido/gradido/compare/0.9.1...0.9.2)
|
#### [0.9.2](https://github.com/gradido/gradido/compare/0.9.1...0.9.2)
|
||||||
|
|
||||||
|
> 18 March 2021
|
||||||
|
|
||||||
|
- v0.9.2 [`#51`](https://github.com/gradido/gradido/pull/51)
|
||||||
- Reload after login fixed [`#50`](https://github.com/gradido/gradido/pull/50)
|
- Reload after login fixed [`#50`](https://github.com/gradido/gradido/pull/50)
|
||||||
- Monorepo login server [`#48`](https://github.com/gradido/gradido/pull/48)
|
- Monorepo login server [`#48`](https://github.com/gradido/gradido/pull/48)
|
||||||
- Stage0 [`#3`](https://github.com/gradido/gradido/pull/3)
|
- Stage0 [`#3`](https://github.com/gradido/gradido/pull/3)
|
||||||
|
|||||||
@ -39,33 +39,144 @@ class StateBalancesController extends AppController
|
|||||||
$this->set(compact('stateBalances'));
|
$this->set(compact('stateBalances'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateBalances($state_user_id)
|
private function updateBalances($stateUserId)
|
||||||
{
|
{
|
||||||
$state_balances = $this->StateBalances->find('all')->where(['state_user_id' => $state_user_id]);
|
|
||||||
if($state_balances->count() == 1) {
|
|
||||||
$stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions');
|
$stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions');
|
||||||
|
$transactionsTable = TableRegistry::getTableLocator()->get('Transactions');
|
||||||
|
// info: cakephp use lazy loading, query will be executed later only if needed
|
||||||
|
$state_balances = $this->StateBalances->find('all')->where(['state_user_id' => $stateUserId]);
|
||||||
$state_user_transactions = $stateUserTransactionsTable
|
$state_user_transactions = $stateUserTransactionsTable
|
||||||
->find('all')
|
->find('all')
|
||||||
->where(['state_user_id' => $state_user_id])
|
->where(['state_user_id' => $stateUserId])
|
||||||
->order(['transaction_id ASC'])
|
->order(['transaction_id ASC'])
|
||||||
->contain(['']);
|
->contain(false);
|
||||||
if($state_user_transactions->count() == 0){
|
|
||||||
return;
|
if(!$state_user_transactions) {
|
||||||
|
//debug($state_user_transactions);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// first: decide what todo
|
||||||
|
$create_state_balance = false;
|
||||||
|
$recalculate_state_user_transactions_balance = false;
|
||||||
|
$clear_state_balance = false;
|
||||||
|
$update_state_balance = false;
|
||||||
|
if($state_balances->count() == 0) {
|
||||||
|
$create_state_balance = true;
|
||||||
|
}
|
||||||
|
if($state_balances->count() > 1) {
|
||||||
|
$clear_state_balance = true;
|
||||||
|
$create_state_balance = true;
|
||||||
|
}
|
||||||
|
if($state_balances->count() == 1) {
|
||||||
|
if($state_user_transactions->count() == 0){
|
||||||
|
$clear_state_balance = true;
|
||||||
|
} else {
|
||||||
$last_state_user_transaction = $state_user_transactions->last();
|
$last_state_user_transaction = $state_user_transactions->last();
|
||||||
$last_transaction = $this->StateBalance->newEntity();
|
$last_transaction = $this->StateBalances->newEntity();
|
||||||
$last_transaction->amount = $last_state_user_transaction->balance;
|
$last_transaction->amount = $last_state_user_transaction->balance;
|
||||||
$last_transaction->record_date = $last_state_user_transaction->balance_date;
|
$last_transaction->record_date = $last_state_user_transaction->balance_date;
|
||||||
// if entrys are nearly the same, we don't need doing anything
|
// if entrys are nearly the same, we don't need doing anything
|
||||||
if(abs($last_transaction->decay - $state_balances->decay) < 100) {
|
if(abs($last_transaction->decay - $state_balances->first()->decay) > 100) {
|
||||||
return;
|
$recalculate_state_user_transactions_balance = true;
|
||||||
|
$update_state_balance = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach($state_user_transactions as $state_user_transaction) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$recalculate_state_user_transactions_balance) {
|
||||||
|
$last_state_user_transaction = $state_user_transactions->last();
|
||||||
|
if($last_state_user_transaction->balance <= 0) {
|
||||||
|
$recalculate_state_user_transactions_balance = true;
|
||||||
|
if(!$create_state_balance) {
|
||||||
|
$update_state_balance = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// second: do what is needed
|
||||||
|
if($clear_state_balance) {
|
||||||
|
$this->StateBalances->deleteAll(['state_user_id' => $stateUserId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction_ids = [];
|
||||||
|
if($recalculate_state_user_transactions_balance) {
|
||||||
|
$state_user_transactions_array = $state_user_transactions->toArray();
|
||||||
|
foreach($state_user_transactions_array as $i => $state_user_transaction) {
|
||||||
|
$transaction_ids[$state_user_transaction->transaction_id] = $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
$transactions = $transactionsTable
|
||||||
|
->find('all')
|
||||||
|
->where(['id IN' => array_keys($transaction_ids)])
|
||||||
|
->contain(['TransactionCreations', 'TransactionSendCoins']);
|
||||||
|
|
||||||
|
$balance_cursor = $this->StateBalances->newEntity();
|
||||||
|
$i = 0;
|
||||||
|
foreach($transactions as $transaction) {
|
||||||
|
if($transaction->transaction_type_id > 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$amount_date = null;
|
||||||
|
$amount = 0;
|
||||||
|
|
||||||
|
if($transaction->transaction_type_id == 1) {
|
||||||
|
$temp = $transaction->transaction_creations[0];
|
||||||
|
|
||||||
|
$balance_temp = $this->StateBalances->newEntity();
|
||||||
|
$balance_temp->amount = $temp->amount;
|
||||||
|
$balance_temp->record_date = $temp->target_date;
|
||||||
|
|
||||||
|
$amount = $balance_temp->partDecay($transaction->received);
|
||||||
|
$amount_date = $transaction->received;
|
||||||
|
//$amount_date =
|
||||||
|
} else if($transaction->transaction_type_id == 2) {
|
||||||
|
$temp = $transaction->transaction_send_coins[0];
|
||||||
|
$amount = intval($temp->amount);
|
||||||
|
// reverse if sender
|
||||||
|
if($stateUserId == $temp->state_user_id) {
|
||||||
|
$amount *= -1.0;
|
||||||
|
}
|
||||||
|
$amount_date = $transaction->received;
|
||||||
|
}
|
||||||
|
if($i == 0) {
|
||||||
|
$balance_cursor->amount = $amount;
|
||||||
|
} else {
|
||||||
|
$balance_cursor->amount = $balance_cursor->partDecay($amount_date) + $amount;
|
||||||
|
}
|
||||||
|
$balance_cursor->record_date = $amount_date;
|
||||||
|
$state_user_transaction_index = $transaction_ids[$transaction->id];
|
||||||
|
$state_user_transactions_array[$state_user_transaction_index]->balance = $balance_cursor->amount;
|
||||||
|
$state_user_transactions_array[$state_user_transaction_index]->balance_date = $balance_cursor->record_date;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$results = $stateUserTransactionsTable->saveMany($state_user_transactions_array);
|
||||||
|
$errors = [];
|
||||||
|
foreach($results as $i => $result) {
|
||||||
|
if(!$result) {
|
||||||
|
$errors[$i] = $state_user_transactions_array[$i]->getErrors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($errors)) {
|
||||||
|
return ['success' => false, 'error' => 'error saving one ore more state user transactions', 'details' => $errors];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$state_balance = null;
|
||||||
|
if($update_state_balance) {
|
||||||
|
$state_balance = $state_balances->first();
|
||||||
|
}
|
||||||
|
else if($create_state_balance) {
|
||||||
|
$state_balance = $this->StateBalances->newEntity();
|
||||||
|
$state_balance->state_user_id = $stateUserId;
|
||||||
|
}
|
||||||
|
if($state_balance) {
|
||||||
|
$state_balance->amount = $state_user_transactions->last()->balance;
|
||||||
|
$state_balance->record_date = $state_user_transactions->last()->balance_date;
|
||||||
|
if(!$this->StateBalances->save($state_balance)) {
|
||||||
|
return ['success' => false, 'error' => 'error saving state balance', 'details' => $state_balance->getErrors()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function overview()
|
public function overview()
|
||||||
{
|
{
|
||||||
@ -82,7 +193,9 @@ class StateBalancesController extends AppController
|
|||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $session->read('StateUser');
|
$user = $session->read('StateUser');
|
||||||
|
$this->updateBalances($user['id']);
|
||||||
// sendRequestGDT
|
// sendRequestGDT
|
||||||
// listPerEmailApi
|
// listPerEmailApi
|
||||||
|
|
||||||
@ -214,6 +327,7 @@ class StateBalancesController extends AppController
|
|||||||
}
|
}
|
||||||
$session = $this->getRequest()->getSession();
|
$session = $this->getRequest()->getSession();
|
||||||
$user = $session->read('StateUser');
|
$user = $session->read('StateUser');
|
||||||
|
$this->updateBalances($user['id']);
|
||||||
|
|
||||||
$public_key_bin = hex2bin($user['public_hex']);
|
$public_key_bin = hex2bin($user['public_hex']);
|
||||||
$stateUserQuery = $this->StateBalances->StateUsers
|
$stateUserQuery = $this->StateBalances->StateUsers
|
||||||
|
|||||||
@ -69,14 +69,14 @@ class StateUsersController extends AppController
|
|||||||
$this->set(compact('stateUsers'));
|
$this->set(compact('stateUsers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listIdentHashes()
|
/*public function listIdentHashes()
|
||||||
{
|
{
|
||||||
$stateUsers = $this->StateUsers->find('all')->toArray();
|
$stateUsers = $this->StateUsers->find('all')->toArray();
|
||||||
foreach ($stateUsers as $i => $user) {
|
foreach ($stateUsers as $i => $user) {
|
||||||
$stateUsers[$i]->identHash = TransactionCreation::DRMakeStringHash($user->email);
|
$stateUsers[$i]->identHash = TransactionCreation::DRMakeStringHash($user->email);
|
||||||
}
|
}
|
||||||
$this->set('stateUsers', $stateUsers);
|
$this->set('stateUsers', $stateUsers);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public function search()
|
public function search()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,12 +54,12 @@ class TransactionCreationsController extends AppController
|
|||||||
];
|
];
|
||||||
$transactionCreations = $this->paginate($this->TransactionCreations);
|
$transactionCreations = $this->paginate($this->TransactionCreations);
|
||||||
$identHashes = [];
|
$identHashes = [];
|
||||||
foreach ($transactionCreations as $creation) {
|
/*foreach ($transactionCreations as $creation) {
|
||||||
$identHash = TransactionCreation::DRMakeStringHash($creation->state_user->email);
|
$identHash = TransactionCreation::DRMakeStringHash($creation->state_user->email);
|
||||||
$identHashes[$creation->state_user->id] = $identHash;
|
$identHashes[$creation->state_user->id] = $identHash;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$this->set(compact('transactionCreations', 'identHashes'));
|
//$this->set(compact('transactionCreations', 'identHashes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,7 +125,7 @@ class TransactionCreationsController extends AppController
|
|||||||
|
|
||||||
if (count($receiverProposal) > $receiverIndex) {
|
if (count($receiverProposal) > $receiverIndex) {
|
||||||
$pubKeyHex = $receiverProposal[$receiverIndex]['key'];
|
$pubKeyHex = $receiverProposal[$receiverIndex]['key'];
|
||||||
$identHash = TransactionCreation::DRMakeStringHash($receiverProposal[$receiverIndex]['email']);
|
//$identHash = TransactionCreation::DRMakeStringHash($receiverProposal[$receiverIndex]['email']);
|
||||||
}
|
}
|
||||||
$builderResult = TransactionCreation::build(
|
$builderResult = TransactionCreation::build(
|
||||||
$amountCent,
|
$amountCent,
|
||||||
@ -369,7 +369,20 @@ class TransactionCreationsController extends AppController
|
|||||||
$pendings[$id] = $localAmountCent;
|
$pendings[$id] = $localAmountCent;
|
||||||
}
|
}
|
||||||
$pubKeyHex = bin2hex(stream_get_contents($receiverUser->public_key));
|
$pubKeyHex = bin2hex(stream_get_contents($receiverUser->public_key));
|
||||||
$identHash = TransactionCreation::DRMakeStringHash($receiverUser->email);
|
$requestAnswear = $this->JsonRequestClient->sendRequest(json_encode([
|
||||||
|
'session_id' => $session->read('session_id'),
|
||||||
|
'email' => $receiverUser->email,
|
||||||
|
'ask' => ['user.identHash']
|
||||||
|
]), '/getUserInfos');
|
||||||
|
|
||||||
|
$identHash = 0;
|
||||||
|
if('success' == $requestAnswear['state'] && 'success' == $requestAnswear['data']['state']) {
|
||||||
|
$identHash = $requestAnswear['data']['userData']['identHash'];
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('Error by requesting LoginServer, please try again'));
|
||||||
|
}
|
||||||
|
|
||||||
|
//$identHash = TransactionCreation::DRMakeStringHash($receiverUser->email);
|
||||||
$localTargetDateFrozen = FrozenDate::now();
|
$localTargetDateFrozen = FrozenDate::now();
|
||||||
$localTargetDateFrozen = $localTargetDateFrozen
|
$localTargetDateFrozen = $localTargetDateFrozen
|
||||||
->year($localTargetDate['year'])
|
->year($localTargetDate['year'])
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class StateBalance extends Entity
|
|||||||
if($decay_duration === 0) {
|
if($decay_duration === 0) {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
return $this->amount * pow(0.99999997802044727, $decay_duration);
|
return $this->amount;
|
||||||
|
//return $this->amount * pow(0.99999997802044727, $decay_duration);
|
||||||
|
|
||||||
}
|
}
|
||||||
public function partDecay($target_date)
|
public function partDecay($target_date)
|
||||||
@ -67,7 +68,8 @@ class StateBalance extends Entity
|
|||||||
if($decay_duration <= 0) {
|
if($decay_duration <= 0) {
|
||||||
return $this->amount;
|
return $this->amount;
|
||||||
}
|
}
|
||||||
return $this->amount * pow(0.99999997802044727, $decay_duration);
|
return 0;
|
||||||
|
//return $this->amount * pow(0.99999997802044727, $decay_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decayDuration($target_date)
|
public function decayDuration($target_date)
|
||||||
|
|||||||
@ -63,24 +63,6 @@ class TransactionCreation extends TransactionBase {
|
|||||||
return ['state' => 'success', 'transactionBody' => $transactionBody];
|
return ['state' => 'success', 'transactionBody' => $transactionBody];
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected function DRHashRotateLeft( $hash, $rotateBy )
|
|
||||||
{
|
|
||||||
return ($hash<<$rotateBy)|($hash>>(32-$rotateBy));
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function DRMakeStringHash($str)
|
|
||||||
{
|
|
||||||
$ret = 0;
|
|
||||||
|
|
||||||
if( $str )
|
|
||||||
{
|
|
||||||
for ($i=0; $i < strlen($str); $i++)
|
|
||||||
{
|
|
||||||
$ret = TransactionCreation::DRHashRotateLeft($ret, 7) + ord($str{$i});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAmount() {
|
public function getAmount() {
|
||||||
return $this->protoTransactionCreation->getReceiverAmount()->getAmount();
|
return $this->protoTransactionCreation->getReceiverAmount()->getAmount();
|
||||||
@ -272,7 +254,7 @@ class TransactionCreation extends TransactionBase {
|
|||||||
->setSubject(__('Gradido Schöpfung erhalten'))
|
->setSubject(__('Gradido Schöpfung erhalten'))
|
||||||
->send();
|
->send();
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
$this->addError('TransactionCreation::sendNotificationEmail', 'error sending notification email: ' . $e->getMessage());
|
// $this->addError('TransactionCreation::sendNotificationEmail', 'error sending notification email: ' . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -303,7 +285,7 @@ class TransactionCreation extends TransactionBase {
|
|||||||
|
|
||||||
// intval
|
// intval
|
||||||
//$protoCreation->setIdentHash(intval($identHashBytes));
|
//$protoCreation->setIdentHash(intval($identHashBytes));
|
||||||
$protoCreation->setIdentHash(self::DRMakeStringHash($stateUser->email));
|
//$protoCreation->setIdentHash(self::DRMakeStringHash($stateUser->email));
|
||||||
return new TransactionCreation($protoCreation);
|
return new TransactionCreation($protoCreation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,8 @@ class TransactionTransfer extends TransactionBase {
|
|||||||
foreach($sigPairs as $sigPair) {
|
foreach($sigPairs as $sigPair) {
|
||||||
//echo 'sig Pair: '; var_dump($sigPair); echo "<br>";
|
//echo 'sig Pair: '; var_dump($sigPair); echo "<br>";
|
||||||
$pubkey = bin2hex($sigPair->getPubKey());
|
$pubkey = bin2hex($sigPair->getPubKey());
|
||||||
$hash = TransactionCreation::DRMakeStringHash($pubkey);
|
//$hash = TransactionCreation::DRMakeStringHash($pubkey);
|
||||||
|
$hash = $pubkey;
|
||||||
if(!isset($sigPubHexs[$hash])) {
|
if(!isset($sigPubHexs[$hash])) {
|
||||||
$sigPubHexs[$hash] = [$pubkey];
|
$sigPubHexs[$hash] = [$pubkey];
|
||||||
} else {
|
} else {
|
||||||
@ -100,7 +101,8 @@ class TransactionTransfer extends TransactionBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if signature exist for sender
|
// check if signature exist for sender
|
||||||
$hash = TransactionCreation::DRMakeStringHash($senderPublicHex);
|
//$hash = TransactionCreation::DRMakeStringHash($senderPublicHex);
|
||||||
|
$hash = $senderPublicHex;
|
||||||
if(!isset($sigPubHexs[$hash]) || in_array($senderPublicHex, $sigPubHexs[$hash]) === FALSE) {
|
if(!isset($sigPubHexs[$hash]) || in_array($senderPublicHex, $sigPubHexs[$hash]) === FALSE) {
|
||||||
$this->addError($functionName, 'missing signature for sender');
|
$this->addError($functionName, 'missing signature for sender');
|
||||||
return false;
|
return false;
|
||||||
@ -253,7 +255,7 @@ class TransactionTransfer extends TransactionBase {
|
|||||||
->setSubject(__('Gradidos erhalten'))
|
->setSubject(__('Gradidos erhalten'))
|
||||||
->send();
|
->send();
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
$this->addError('TransactionTransfer::sendNotificationEmail', 'error sending notification email: ' . $e->getMessage());
|
//$this->addError('TransactionTransfer::sendNotificationEmail', 'error sending notification email: ' . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -38,6 +38,10 @@ services:
|
|||||||
## NGINX ################################################
|
## NGINX ################################################
|
||||||
#########################################################
|
#########################################################
|
||||||
nginx:
|
nginx:
|
||||||
|
depends_on:
|
||||||
|
- frontend
|
||||||
|
- community-server
|
||||||
|
- login-server
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/var/log/nginx
|
- ./logs:/var/log/nginx
|
||||||
|
|
||||||
@ -75,3 +79,4 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
frontend_node_modules:
|
frontend_node_modules:
|
||||||
conan:
|
conan:
|
||||||
|
|
||||||
|
|||||||
@ -16,8 +16,6 @@ services:
|
|||||||
target: production
|
target: production
|
||||||
networks:
|
networks:
|
||||||
- external-net
|
- external-net
|
||||||
depends_on:
|
|
||||||
- nginx
|
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@ -210,3 +210,45 @@ return
|
|||||||
- user hasn't password: if user hasn't set a password yet (for example if he was registered via elopage)
|
- user hasn't password: if user hasn't set a password yet (for example if he was registered via elopage)
|
||||||
- email already activated: if email was already checked
|
- email already activated: if email was already checked
|
||||||
- session_id: session_id for new session
|
- session_id: session_id for new session
|
||||||
|
|
||||||
|
|
||||||
|
## Check Running Transactions / password encryption
|
||||||
|
Check if transactions on login-server for user are processed
|
||||||
|
|
||||||
|
GET http://localhost/login_api/getRunningUserTasks?email=max.musterman%40gmail.de
|
||||||
|
# OR
|
||||||
|
POST http://localhost/login_api/getRunningUserTasks
|
||||||
|
```json
|
||||||
|
{"email":"max.musterman@gmail.de"}
|
||||||
|
```
|
||||||
|
|
||||||
|
return
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"state":"success",
|
||||||
|
"runningTasks": {
|
||||||
|
"password creation": 0,
|
||||||
|
"sign transaction": 1,
|
||||||
|
"prepare transaction": 1,
|
||||||
|
"ready for sign transaction":0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
return only entrys which > 0
|
||||||
|
- password creation: after register or password change, login possible after tasks is finish
|
||||||
|
- sign transaction: after check transaction in backend, before transaction is in db
|
||||||
|
- prepare transaction: after sending transaction to login-server, before they can be checked
|
||||||
|
- ready for sign transaction: transactions ready for signing from user
|
||||||
|
|
||||||
|
## Check Session State
|
||||||
|
GET http://localhost/login_api/checkSessionState?session_id=-127182
|
||||||
|
|
||||||
|
return if session is still open
|
||||||
|
```json
|
||||||
|
{"state":"success"}
|
||||||
|
```
|
||||||
|
else return
|
||||||
|
```json
|
||||||
|
{"state":"not found", "msg": "session not found"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@babel/preset-env"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"test": {
|
|
||||||
"plugins": ["require-context-hook"],
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@babel/preset-env",
|
|
||||||
{
|
|
||||||
"targets": {
|
|
||||||
"node": "10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,3 +1,4 @@
|
|||||||
LOGIN_API_URL=http://localhost/login_api/
|
LOGIN_API_URL=http://localhost/login_api/
|
||||||
COMMUNITY_API_STATE_BALANCE_URL=http://localhost/state-balances/
|
COMMUNITY_API_STATE_BALANCE_URL=http://localhost/state-balances/
|
||||||
COMMUNITY_API_TRANSACTION_CREATION_URL=http://localhost/transaction-creations/
|
COMMUNITY_API_TRANSACTION_CREATION_URL=http://localhost/transaction-creations/
|
||||||
|
VUE_PATH=/vue
|
||||||
@ -1,5 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: ['@vue/app'],
|
presets: ['@babel/preset-env'],
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
'component',
|
'component',
|
||||||
|
|||||||
@ -10,16 +10,15 @@ module.exports = {
|
|||||||
coverageReporters: ['lcov'],
|
coverageReporters: ['lcov'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^@/(.*)$': '<rootDir>/src/$1',
|
'^@/(.*)$': '<rootDir>/src/$1',
|
||||||
|
'\\.(css|less)$': 'identity-obj-proxy',
|
||||||
},
|
},
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.vue$': 'vue-jest',
|
'^.+\\.vue$': '<rootDir>/node_modules/vue-jest',
|
||||||
// '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
|
'^.+\\.(js|jsx)?$': '<rootDir>/node_modules/babel-jest',
|
||||||
'^.+\\.(js|jsx)?$': 'babel-jest',
|
|
||||||
},
|
},
|
||||||
//setupFiles: [
|
setupFiles: ['<rootDir>/test/testSetup.js'],
|
||||||
// "<rootDir>/test/registerContext.js"
|
|
||||||
//],
|
|
||||||
testMatch: ['**/?(*.)+(spec|test).js?(x)'],
|
testMatch: ['**/?(*.)+(spec|test).js?(x)'],
|
||||||
// snapshotSerializers: ['jest-serializer-vue'],
|
// snapshotSerializers: ['jest-serializer-vue'],
|
||||||
transformIgnorePatterns: ['<rootDir>/node_modules/'],
|
transformIgnorePatterns: ['<rootDir>/node_modules/'],
|
||||||
|
preset: '@vue/cli-plugin-unit-jest',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bootstrap-vue-gradido-wallet",
|
"name": "bootstrap-vue-gradido-wallet",
|
||||||
"version": "0.9.2",
|
"version": "0.9.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server.js",
|
"start": "node server.js",
|
||||||
@ -12,11 +12,16 @@
|
|||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/core": "^7.13.13",
|
||||||
|
"@babel/node": "^7.13.13",
|
||||||
|
"@babel/preset-env": "^7.13.12",
|
||||||
|
"@vue/cli-plugin-unit-jest": "^4.5.12",
|
||||||
"@vue/test-utils": "^1.1.3",
|
"@vue/test-utils": "^1.1.3",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
"babel-jest": "^26.6.3",
|
"babel-jest": "^26.6.3",
|
||||||
"babel-plugin-require-context-hook": "^1.0.0",
|
"babel-plugin-require-context-hook": "^1.0.0",
|
||||||
|
"babel-preset-vue": "^2.0.2",
|
||||||
"bootstrap": "4.3.1",
|
"bootstrap": "4.3.1",
|
||||||
"bootstrap-vue": "^2.5.0",
|
"bootstrap-vue": "^2.5.0",
|
||||||
"chart.js": "^2.9.3",
|
"chart.js": "^2.9.3",
|
||||||
@ -41,6 +46,7 @@
|
|||||||
"flatpickr": "^4.5.7",
|
"flatpickr": "^4.5.7",
|
||||||
"fuse.js": "^3.2.0",
|
"fuse.js": "^3.2.0",
|
||||||
"google-maps": "^3.2.1",
|
"google-maps": "^3.2.1",
|
||||||
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"nouislider": "^12.1.0",
|
"nouislider": "^12.1.0",
|
||||||
"particles-bg-vue": "1.2.3",
|
"particles-bg-vue": "1.2.3",
|
||||||
|
|||||||
104
frontend/src/views/Layout/ContentFooter.spec.js
Normal file
104
frontend/src/views/Layout/ContentFooter.spec.js
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
|
||||||
|
import ContentFooter from './ContentFooter'
|
||||||
|
|
||||||
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
describe('ContentFooter', () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
let mocks = {
|
||||||
|
$i18n: {
|
||||||
|
locale: 'en',
|
||||||
|
},
|
||||||
|
$t: jest.fn((t) => t),
|
||||||
|
}
|
||||||
|
|
||||||
|
const Wrapper = () => {
|
||||||
|
return mount(ContentFooter, { localVue, mocks })
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('mount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the content footer', () => {
|
||||||
|
expect(wrapper.find('footer.footer').exists()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('copyright', () => {
|
||||||
|
it('shows the copyright', () => {
|
||||||
|
expect(wrapper.find('div.copyright').exists()).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders the copyright year', () => {
|
||||||
|
expect(wrapper.find('div.copyright').text()).toMatch(/©\s*2[0-9]{3,3}\s+/)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders a link to Gradido-Akademie', () => {
|
||||||
|
expect(wrapper.find('div.copyright').find('a').text()).toEqual('Gradido-Akademie')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the login page when clicked on copyright', () => {
|
||||||
|
expect(wrapper.find('div.copyright').find('a').attributes('href')).toEqual('#/Login')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('links to gradido.net', () => {
|
||||||
|
it('has a link to the gradido.net', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(0).text()).toEqual('Gradido')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the https://gradido.net/en when locale is en', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
|
||||||
|
'https://gradido.net/en',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a link to the legal notice', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(1).text()).toEqual('imprint')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the https://gradido.net/en/impressum when locale is en', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual(
|
||||||
|
'https://gradido.net/en/impressum/',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a link to the privacy policy', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(2).text()).toEqual('privacy_policy')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the https://gradido.net/en/datenschutz when locale is en', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual(
|
||||||
|
'https://gradido.net/en/datenschutz/',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('links are localized', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
mocks.$i18n.locale = 'de'
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the https://gradido.net/de when locale is de', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
|
||||||
|
'https://gradido.net/de',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the https://gradido.net/de/impressum when locale is de', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual(
|
||||||
|
'https://gradido.net/de/impressum/',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to the https://gradido.net/de/datenschutz when locale is de', () => {
|
||||||
|
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual(
|
||||||
|
'https://gradido.net/de/datenschutz/',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -4,7 +4,7 @@
|
|||||||
<b-col>
|
<b-col>
|
||||||
<div class="copyright text-center text-lg-center text-muted">
|
<div class="copyright text-center text-lg-center text-muted">
|
||||||
© {{ year }}
|
© {{ year }}
|
||||||
<a href="#!" to="/login" class="font-weight-bold ml-1">Gradido-Akademie</a>
|
<a href="#/Login" class="font-weight-bold ml-1">Gradido-Akademie</a>
|
||||||
</div>
|
</div>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|||||||
8
frontend/test/testSetup.js
Normal file
8
frontend/test/testSetup.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { createLocalVue } from '@vue/test-utils'
|
||||||
|
import ElementUI from 'element-ui'
|
||||||
|
import BootstrapVue from 'bootstrap-vue'
|
||||||
|
|
||||||
|
global.localVue = createLocalVue()
|
||||||
|
|
||||||
|
global.localVue.use(ElementUI)
|
||||||
|
global.localVue.use(BootstrapVue)
|
||||||
@ -4,6 +4,12 @@ const dotenv = require('dotenv-webpack')
|
|||||||
function resolveSrc(_path) {
|
function resolveSrc(_path) {
|
||||||
return path.join(__dirname, _path)
|
return path.join(__dirname, _path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let vue_path = process.env.VUE_PATH
|
||||||
|
if (vue_path == undefined) {
|
||||||
|
vue_path = ''
|
||||||
|
}
|
||||||
|
|
||||||
// vue.config.js
|
// vue.config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
pluginOptions: {
|
pluginOptions: {
|
||||||
@ -15,6 +21,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
lintOnSave: true,
|
lintOnSave: true,
|
||||||
|
publicPath: vue_path + '/',
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
// Set up all the aliases we use in our app.
|
// Set up all the aliases we use in our app.
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -28,4 +35,5 @@ module.exports = {
|
|||||||
// Enable CSS source maps.
|
// Enable CSS source maps.
|
||||||
sourceMap: process.env.NODE_ENV !== 'production',
|
sourceMap: process.env.NODE_ENV !== 'production',
|
||||||
},
|
},
|
||||||
|
outputDir: path.resolve(__dirname, './dist' + vue_path),
|
||||||
}
|
}
|
||||||
|
|||||||
1736
frontend/yarn.lock
1736
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
2
gn
2
gn
@ -1 +1 @@
|
|||||||
Subproject commit a61871987261614102b11ed58791081be1954d3c
|
Subproject commit 5437e2f882c54efe4f501f7cd0d97f53806d0b74
|
||||||
@ -1,18 +1,3 @@
|
|||||||
#########################################################################################################
|
|
||||||
# Build protoc
|
|
||||||
#########################################################################################################
|
|
||||||
FROM gcc:7.5 as protoc_build
|
|
||||||
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
|
|
||||||
WORKDIR /protobuf
|
|
||||||
|
|
||||||
RUN git checkout v3.9.1
|
|
||||||
RUN ./autogen.sh
|
|
||||||
RUN ./configure --enable-static=yes
|
|
||||||
RUN make -j$(grep processor /proc/cpuinfo | wc -l)
|
|
||||||
RUN make check
|
|
||||||
|
|
||||||
CMD ["./protobuf"]
|
|
||||||
|
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
# Build release
|
# Build release
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
@ -22,11 +7,10 @@ ENV DOCKER_WORKDIR="/code"
|
|||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
COPY --from=protoc_build /protobuf/src/.libs/protoc /usr/bin/
|
COPY --from=unicorny/protoc:3.9.1 /usr/bin/protoc /usr/bin/
|
||||||
COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
|
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotobuf.so.20 /usr/lib/libprotobuf.so.20
|
||||||
COPY --from=protoc_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20
|
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotoc.so.20 /usr/lib/libprotoc.so.20
|
||||||
COPY --from=protoc_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/
|
COPY --from=unicorny/protoc:3.9.1 /usr/include/google/protobuf/* /usr/include/google/protobuf/
|
||||||
COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
|
|
||||||
|
|
||||||
|
|
||||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||||
@ -40,7 +24,7 @@ RUN cd dependencies/iroha-ed25519 && \
|
|||||||
mkdir build && \
|
mkdir build && \
|
||||||
cd build && \
|
cd build && \
|
||||||
cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
|
cmake .. -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
|
||||||
make -j$(grep processor /proc/cpuinfo | wc -l)
|
make -j$(nproc)
|
||||||
|
|
||||||
RUN cd dependencies/mariadb-connector-c && \
|
RUN cd dependencies/mariadb-connector-c && \
|
||||||
mkdir build && \
|
mkdir build && \
|
||||||
@ -56,7 +40,7 @@ RUN mkdir build && \
|
|||||||
cd build && \
|
cd build && \
|
||||||
conan install .. --build=missing && \
|
conan install .. --build=missing && \
|
||||||
cmake .. && \
|
cmake .. && \
|
||||||
make -j$(grep processor /proc/cpuinfo | wc -l) Gradido_LoginServer
|
make -j$(nproc) Gradido_LoginServer
|
||||||
|
|
||||||
|
|
||||||
CMD ["./code"]
|
CMD ["./code"]
|
||||||
|
|||||||
@ -1,83 +1,21 @@
|
|||||||
#########################################################################################################
|
|
||||||
# Build protoc
|
|
||||||
#########################################################################################################
|
|
||||||
FROM gcc:7.5 as protoc_build
|
|
||||||
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
|
|
||||||
WORKDIR /protobuf
|
|
||||||
|
|
||||||
RUN git checkout v3.9.1
|
|
||||||
RUN ./autogen.sh
|
|
||||||
RUN ./configure --enable-static=yes
|
|
||||||
RUN make -j$(grep processor /proc/cpuinfo | wc -l)
|
|
||||||
RUN make check
|
|
||||||
|
|
||||||
CMD ["./protobuf"]
|
|
||||||
|
|
||||||
#########################################################################################################
|
|
||||||
# debug build preparation
|
|
||||||
#########################################################################################################
|
|
||||||
|
|
||||||
From conanio/gcc7 as debug_preparation
|
|
||||||
|
|
||||||
ENV DOCKER_WORKDIR="/code"
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
COPY --from=protoc_build /protobuf/src/.libs/protoc /usr/bin/
|
|
||||||
COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
|
|
||||||
COPY --from=protoc_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20
|
|
||||||
COPY --from=protoc_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/
|
|
||||||
COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
|
|
||||||
|
|
||||||
#VOLUME /root/.conan
|
|
||||||
|
|
||||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
|
||||||
WORKDIR ${DOCKER_WORKDIR}
|
|
||||||
|
|
||||||
COPY ./dependencies ./dependencies
|
|
||||||
COPY ./conanfile.txt ./conanfile.txt
|
|
||||||
|
|
||||||
RUN ls -la
|
|
||||||
RUN cd dependencies/iroha-ed25519 && \
|
|
||||||
ls -la && \
|
|
||||||
mkdir build && \
|
|
||||||
cd build && \
|
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
|
|
||||||
make -j$(grep processor /proc/cpuinfo | wc -l)
|
|
||||||
|
|
||||||
RUN cd dependencies/mariadb-connector-c && \
|
|
||||||
mkdir build && \
|
|
||||||
cd build && \
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=OFF ..
|
|
||||||
|
|
||||||
|
|
||||||
#RUN chmod +x compile_proto.sh
|
|
||||||
#RUN chmod +x compile_pot.sh
|
|
||||||
#RUN ls -la
|
|
||||||
#RUN ./compile_pot.sh
|
|
||||||
#RUN ./compile_proto.sh
|
|
||||||
RUN mkdir build && \
|
|
||||||
cd build && \
|
|
||||||
conan install .. --build=missing -s build_type=Debug
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
# Build debug
|
# Build debug
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
From debug_preparation as debug
|
From gradido/login_dependencies:stage1 as debug
|
||||||
|
|
||||||
ENV DOCKER_WORKDIR="/code"
|
ENV DOCKER_WORKDIR="/code"
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
#VOLUME /root/.conan
|
#VOLUME /root/.conan
|
||||||
|
|
||||||
RUN apt-get update && \
|
#RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends gdb && \
|
# apt-get install -y --no-install-recommends gdb && \
|
||||||
apt-get autoclean && \
|
# apt-get autoclean && \
|
||||||
apt-get autoremove && \
|
# apt-get autoremove && \
|
||||||
apt-get clean && \
|
# apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
# rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
#COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
|
#COPY --from=protoc_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
|
||||||
#COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
|
#COPY --from=protoc_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
|
||||||
@ -86,8 +24,8 @@ RUN apt-get update && \
|
|||||||
#COPY --from=debug_preparation /code /code
|
#COPY --from=debug_preparation /code /code
|
||||||
#COPY --from=debug_preparation /home/conan /home/conan
|
#COPY --from=debug_preparation /home/conan /home/conan
|
||||||
#RUN ls -la /home/conan/.conan
|
#RUN ls -la /home/conan/.conan
|
||||||
COPY . .
|
|
||||||
WORKDIR ${DOCKER_WORKDIR}
|
WORKDIR ${DOCKER_WORKDIR}
|
||||||
|
COPY . .
|
||||||
|
|
||||||
#RUN ls -la
|
#RUN ls -la
|
||||||
#RUN cat build/conanbuildinfo.cmake
|
#RUN cat build/conanbuildinfo.cmake
|
||||||
@ -96,18 +34,15 @@ RUN chmod +x compile_pot.sh
|
|||||||
#RUN ls -la
|
#RUN ls -la
|
||||||
RUN ./compile_pot.sh
|
RUN ./compile_pot.sh
|
||||||
RUN ./compile_proto.sh
|
RUN ./compile_proto.sh
|
||||||
RUN cd build && \
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug .. && \
|
|
||||||
make -j$(grep processor /proc/cpuinfo | wc -l)
|
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
# run debug
|
# run debug
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
FROM ubuntu:latest as login_server_debug
|
FROM debug as login_server_debug
|
||||||
|
|
||||||
WORKDIR "/usr/bin"
|
|
||||||
|
|
||||||
|
ENV DOCKER_WORKDIR="/code"
|
||||||
#RUN apt-get update && \
|
#RUN apt-get update && \
|
||||||
# apt-get install -y --no-install-recommends gdb && \
|
# apt-get install -y --no-install-recommends gdb && \
|
||||||
# apt-get autoclean && \
|
# apt-get autoclean && \
|
||||||
@ -116,17 +51,17 @@ WORKDIR "/usr/bin"
|
|||||||
# rm -rf /var/lib/apt/lists/*
|
# rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
VOLUME /var/log/grd_login
|
VOLUME /var/log/grd_login
|
||||||
|
VOLUME /code/src
|
||||||
|
|
||||||
COPY --from=debug /code/build/bin/Gradido_LoginServer /usr/bin/
|
|
||||||
COPY --from=debug /code/build/lib/libmariadb.so.3 /usr/lib/
|
|
||||||
#COPY start_after_mysql.sh .
|
|
||||||
RUN chmod +x /usr/bin/Gradido_LoginServer
|
|
||||||
EXPOSE 1200
|
EXPOSE 1200
|
||||||
EXPOSE 1201
|
EXPOSE 1201
|
||||||
|
WORKDIR ${DOCKER_WORKDIR}
|
||||||
|
RUN chmod +x ./Dockerfiles/build_and_run.sh
|
||||||
|
|
||||||
#ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
|
#ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
|
||||||
# Wait on mariadb to started
|
# Wait on mariadb to started
|
||||||
#CMD ["sleep 5", "/usr/bin/Gradido_LoginServer"]
|
#CMD ["sleep 5", "/usr/bin/Gradido_LoginServer"]
|
||||||
#RUN chmod +x ./start_after_mysql.sh
|
#RUN chmod +x ./start_after_mysql.sh
|
||||||
#ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
|
#ENTRYPOINT ["/usr/bin/Gradido_LoginServer"]
|
||||||
#CMD gdb -ex=r Gradido_LoginServer
|
#CMD gdb -ex=r Gradido_LoginServer
|
||||||
CMD Gradido_LoginServer
|
CMD ./Dockerfiles/build_and_run.sh
|
||||||
|
|||||||
46
login_server/Dockerfiles/Dockerfile.dependencies
Normal file
46
login_server/Dockerfiles/Dockerfile.dependencies
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#########################################################################################################
|
||||||
|
# debug build preparation
|
||||||
|
#########################################################################################################
|
||||||
|
|
||||||
|
From conanio/gcc7 as debug_preparation
|
||||||
|
|
||||||
|
ENV DOCKER_WORKDIR="/code"
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
COPY --from=unicorny/protoc:3.9.1 /usr/bin/protoc /usr/bin/
|
||||||
|
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotobuf.so.20 /usr/lib/libprotobuf.so.20
|
||||||
|
COPY --from=unicorny/protoc:3.9.1 /usr/lib/libprotoc.so.20 /usr/lib/libprotoc.so.20
|
||||||
|
COPY --from=unicorny/protoc:3.9.1 /usr/include/google/protobuf/* /usr/include/google/protobuf/
|
||||||
|
|
||||||
|
#VOLUME /root/.conan
|
||||||
|
|
||||||
|
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||||
|
WORKDIR ${DOCKER_WORKDIR}
|
||||||
|
|
||||||
|
COPY ./dependencies ./dependencies
|
||||||
|
COPY ./conanfile.txt ./conanfile.txt
|
||||||
|
|
||||||
|
RUN ls -la
|
||||||
|
RUN cd dependencies/iroha-ed25519 && \
|
||||||
|
ls -la && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=Debug -DEDIMPL=ref10 -DHASH=sha2_sphlib -DRANDOM=bcryptgen -DBUILD=STATIC && \
|
||||||
|
make -j$(nproc)
|
||||||
|
|
||||||
|
RUN cd dependencies/mariadb-connector-c && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_SSL=OFF ..
|
||||||
|
|
||||||
|
|
||||||
|
#RUN chmod +x compile_proto.sh
|
||||||
|
#RUN chmod +x compile_pot.sh
|
||||||
|
#RUN ls -la
|
||||||
|
#RUN ./compile_pot.sh
|
||||||
|
#RUN ./compile_proto.sh
|
||||||
|
RUN mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
conan install .. --build=missing -s build_type=Debug
|
||||||
|
|
||||||
30
login_server/Dockerfiles/Dockerfile.protoc
Normal file
30
login_server/Dockerfiles/Dockerfile.protoc
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#########################################################################################################
|
||||||
|
# Build protoc
|
||||||
|
#########################################################################################################
|
||||||
|
FROM gcc:7.5 as protoc3.9.1_build
|
||||||
|
RUN git clone --recurse-submodules https://github.com/protocolbuffers/protobuf.git
|
||||||
|
WORKDIR /protobuf
|
||||||
|
|
||||||
|
RUN git checkout v3.9.1
|
||||||
|
RUN ./autogen.sh
|
||||||
|
RUN ./configure --enable-static=yes
|
||||||
|
RUN make -j$(nproc)
|
||||||
|
#RUN make check
|
||||||
|
|
||||||
|
CMD ["./protobuf"]
|
||||||
|
|
||||||
|
#########################################################################################################
|
||||||
|
# Store protoc
|
||||||
|
#########################################################################################################
|
||||||
|
FROM alpine:3.10 as protoc
|
||||||
|
|
||||||
|
COPY --from=protoc3.9.1_build /protobuf/src/.libs/protoc /usr/bin/
|
||||||
|
COPY --from=protoc3.9.1_build /protobuf/src/.libs/libprotobuf.so.20.0.1 /usr/lib/libprotobuf.so.20
|
||||||
|
COPY --from=protoc3.9.1_build /protobuf/src/.libs/libprotoc.so.20.0.1 /usr/lib/libprotoc.so.20
|
||||||
|
COPY --from=protoc3.9.1_build /protobuf/src/google/protobuf/*.proto /usr/include/google/protobuf/
|
||||||
|
COPY --from=protoc3.9.1_build /protobuf/src/google/protobuf/*.h /usr/include/google/protobuf/
|
||||||
|
|
||||||
|
## build with:
|
||||||
|
# docker build . -f Dockefile.protoc -t gradido/protoc:3.9.1
|
||||||
|
## upload (login to docker hub on shell before):
|
||||||
|
# docker push gradido/protoc:3.9.1
|
||||||
9
login_server/Dockerfiles/build_and_run.sh
Normal file
9
login_server/Dockerfiles/build_and_run.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cp build/conan* build_vol/
|
||||||
|
cd build_vol
|
||||||
|
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
|
make -j$(nproc) Gradido_LoginServer
|
||||||
|
echo "building done"
|
||||||
|
chmod +x ./bin/Gradido_LoginServer
|
||||||
|
./bin/Gradido_LoginServer
|
||||||
@ -11,16 +11,15 @@ using namespace Poco::Data::Keywords;
|
|||||||
#include "../SingletonManager/ConnectionManager.h"
|
#include "../SingletonManager/ConnectionManager.h"
|
||||||
#include "../SingletonManager/ErrorManager.h"
|
#include "../SingletonManager/ErrorManager.h"
|
||||||
#include "../SingletonManager/SessionManager.h"
|
#include "../SingletonManager/SessionManager.h"
|
||||||
|
#include "../SingletonManager/EmailManager.h"
|
||||||
|
|
||||||
#include "../ServerConfig.h"
|
#include "../ServerConfig.h"
|
||||||
|
|
||||||
#include "../tasks/PrepareEmailTask.h"
|
|
||||||
#include "../tasks/SendEmailTask.h"
|
|
||||||
|
|
||||||
#include "../controller/EmailVerificationCode.h"
|
#include "../controller/EmailVerificationCode.h"
|
||||||
#include "../model/table/ElopageBuy.h"
|
#include "../model/table/ElopageBuy.h"
|
||||||
|
|
||||||
|
#include "../lib/DataTypeConverter.h"
|
||||||
|
|
||||||
|
|
||||||
void ElopageWebhook::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
|
void ElopageWebhook::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
|
||||||
@ -277,22 +276,9 @@ int HandleElopageRequestTask::run()
|
|||||||
saveElopageBuy->scheduleTask(saveElopageBuy);
|
saveElopageBuy->scheduleTask(saveElopageBuy);
|
||||||
|
|
||||||
// check product id
|
// check product id
|
||||||
Poco::UInt64 product_id = 0;
|
unsigned long long product_id = 0;
|
||||||
try {
|
DataTypeConverter::strToInt(mRequestData.get("product[id]", "0"), product_id);
|
||||||
product_id = stoull(mRequestData.get("product[id]", "0"));
|
|
||||||
}
|
|
||||||
catch (const std::invalid_argument& ia) {
|
|
||||||
std::cerr << __FUNCTION__ << "Invalid argument: " << ia.what() << '\n';
|
|
||||||
}
|
|
||||||
catch (const std::out_of_range& oor) {
|
|
||||||
std::cerr << __FUNCTION__ << "Out of Range error: " << oor.what() << '\n';
|
|
||||||
}
|
|
||||||
catch (const std::logic_error & ler) {
|
|
||||||
std::cerr << __FUNCTION__ << "Logical error: " << ler.what() << '\n';
|
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
std::cerr << __FUNCTION__ << "Unknown error" << '\n';
|
|
||||||
}
|
|
||||||
std::string order_id = mRequestData.get("order_id", "");
|
std::string order_id = mRequestData.get("order_id", "");
|
||||||
auto param_error_order_id = new ParamError("HandleElopageRequestTask", "order_id", order_id.data());
|
auto param_error_order_id = new ParamError("HandleElopageRequestTask", "order_id", order_id.data());
|
||||||
|
|
||||||
@ -380,58 +366,18 @@ int HandleElopageRequestTask::run()
|
|||||||
sendErrorsAsEmail();
|
sendErrorsAsEmail();
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
auto em = EmailManager::getInstance();
|
||||||
// write email verification code into db
|
if (emailVerification->getModel()->insertIntoDB(false)) {
|
||||||
UniLib::controller::TaskPtr saveEmailVerificationCode(new model::table::ModelInsertTask(emailVerification->getModel(), true));
|
|
||||||
saveEmailVerificationCode->scheduleTask(saveEmailVerificationCode);
|
|
||||||
int noEMail = 0;
|
int noEMail = 0;
|
||||||
|
DataTypeConverter::strToInt(mRequestData.get("noEmail", "0"), noEMail);
|
||||||
std::string noEmailString = mRequestData.get("noEmail", "0");
|
|
||||||
try {
|
|
||||||
noEMail = stoi(noEmailString);
|
|
||||||
}
|
|
||||||
catch (const std::invalid_argument& ia) {
|
|
||||||
std::cerr << __FUNCTION__ << " Invalid argument: " << ia.what() << ", str: " << noEmailString << '\n';
|
|
||||||
}
|
|
||||||
catch (const std::out_of_range& oor) {
|
|
||||||
std::cerr << __FUNCTION__ << " Out of Range error: " << oor.what() << '\n';
|
|
||||||
}
|
|
||||||
catch (const std::logic_error & ler) {
|
|
||||||
std::cerr << __FUNCTION__ << " Logical error: " << ler.what() << '\n';
|
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
std::cerr << __FUNCTION__ << " Unknown error" << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noEMail != 1) {
|
if (noEMail != 1) {
|
||||||
|
em->addEmail(new model::Email(emailVerification, newUser, model::EMAIL_USER_VERIFICATION_CODE));
|
||||||
// send email to user
|
|
||||||
/*auto message = new Poco::Net::MailMessage;
|
|
||||||
|
|
||||||
message->addRecipient(Poco::Net::MailRecipient(Poco::Net::MailRecipient::PRIMARY_RECIPIENT, mEmail));
|
|
||||||
message->setSubject("Gradido: E-Mail Verification");
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << "Hallo " << mFirstName << " " << mLastName << "," << std::endl << std::endl;
|
|
||||||
ss << "Du oder jemand anderes hat sich soeben mit dieser E-Mail Adresse bei Gradido registriert. " << std::endl;
|
|
||||||
ss << "Wenn du es warst, klicke bitte auf den Link: " << ServerConfig::g_serverPath << "/checkEmail/" << emailVerification->getModel()->getCode() << std::endl;
|
|
||||||
//ss << "oder kopiere den Code: " << mEmailVerificationCode << " selbst dort hinein." << std::endl;
|
|
||||||
ss << "oder kopiere den obigen Link in Dein Browserfenster." << std::endl;
|
|
||||||
ss << std::endl;
|
|
||||||
|
|
||||||
ss << "Mit freundlichen " << u8"Grüßen" << std::endl;
|
|
||||||
ss << "Dario, Gradido Server Admin" << std::endl;
|
|
||||||
|
|
||||||
message->addContent(new Poco::Net::StringPartSource(ss.str()));
|
|
||||||
*/
|
|
||||||
//UniLib::controller::TaskPtr sendEmail(new SendEmailTask(message, ServerConfig::g_CPUScheduler, 1));
|
|
||||||
//Email(AutoPtr<controller::EmailVerificationCode> emailVerification, AutoPtr<controller::User> user, EmailType type);
|
|
||||||
UniLib::controller::TaskPtr sendEmail(new SendEmailTask(new model::Email(emailVerification, newUser, model::EMAIL_USER_VERIFICATION_CODE), ServerConfig::g_CPUScheduler, 1));
|
|
||||||
//sendEmail->setParentTaskPtrInArray(prepareEmail, 0);
|
|
||||||
sendEmail->setParentTaskPtrInArray(saveEmailVerificationCode, 0);
|
|
||||||
sendEmail->scheduleTask(sendEmail);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// if errors occured, send via email
|
// if errors occured, send via email
|
||||||
if (errorCount() > 1) {
|
if (errorCount() > 1) {
|
||||||
addError(param_error_order_id);
|
addError(param_error_order_id);
|
||||||
|
|||||||
53
login_server/src/cpp/JSONInterface/JsonCheckSessionState.cpp
Normal file
53
login_server/src/cpp/JSONInterface/JsonCheckSessionState.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include "JsonCheckSessionState.h"
|
||||||
|
#include "Poco/URI.h"
|
||||||
|
#include "../lib/DataTypeConverter.h"
|
||||||
|
#include "../SingletonManager/SessionManager.h"
|
||||||
|
|
||||||
|
Poco::JSON::Object* JsonCheckSessionState::handle(Poco::Dynamic::Var params)
|
||||||
|
{
|
||||||
|
int session_id = 0;
|
||||||
|
|
||||||
|
bool parameterReaded = false;
|
||||||
|
// if is json object
|
||||||
|
if (params.type() == typeid(Poco::JSON::Object::Ptr)) {
|
||||||
|
Poco::JSON::Object::Ptr paramJsonObject = params.extract<Poco::JSON::Object::Ptr>();
|
||||||
|
/// Throws a RangeException if the value does not fit
|
||||||
|
/// into the result variable.
|
||||||
|
/// Throws a NotImplementedException if conversion is
|
||||||
|
/// not available for the given type.
|
||||||
|
/// Throws InvalidAccessException if Var is empty.
|
||||||
|
try {
|
||||||
|
paramJsonObject->get("session_id").convert(session_id);
|
||||||
|
parameterReaded = true;
|
||||||
|
}
|
||||||
|
catch (Poco::Exception& ex) {
|
||||||
|
return stateError("json exception", ex.displayText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (params.isVector()) {
|
||||||
|
const Poco::URI::QueryParameters queryParams = params.extract<Poco::URI::QueryParameters>();
|
||||||
|
for (auto it = queryParams.begin(); it != queryParams.end(); it++) {
|
||||||
|
if (it->first == "session_id") {
|
||||||
|
DataTypeConverter::strToInt(it->second, session_id);
|
||||||
|
//session_id = it->second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parameterReaded = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return stateError("format not implemented", std::string(params.type().name()));
|
||||||
|
}
|
||||||
|
if (!parameterReaded) {
|
||||||
|
return stateError("parameter couldn't parsed");
|
||||||
|
}
|
||||||
|
auto sm = SessionManager::getInstance();
|
||||||
|
auto session = sm->getSession(session_id);
|
||||||
|
if (session) {
|
||||||
|
return stateSuccess();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return customStateError("not found", "session not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
login_server/src/cpp/JSONInterface/JsonCheckSessionState.h
Normal file
16
login_server/src/cpp/JSONInterface/JsonCheckSessionState.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
|
||||||
|
#define __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
|
||||||
|
|
||||||
|
#include "JsonRequestHandler.h"
|
||||||
|
|
||||||
|
class JsonCheckSessionState : public JsonRequestHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __JSON_INTERFACE_JSON_CHECK_SESSION_STATE_
|
||||||
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "../SingletonManager/SessionManager.h"
|
#include "../SingletonManager/SessionManager.h"
|
||||||
|
|
||||||
|
#include "JsonAdminEmailVerificationResend.h"
|
||||||
|
#include "JsonCheckSessionState.h"
|
||||||
#include "JsonCreateUser.h"
|
#include "JsonCreateUser.h"
|
||||||
#include "JsonGetLogin.h"
|
#include "JsonGetLogin.h"
|
||||||
#include "JsonUnknown.h"
|
#include "JsonUnknown.h"
|
||||||
@ -11,7 +13,6 @@
|
|||||||
#include "JsonGetRunningUserTasks.h"
|
#include "JsonGetRunningUserTasks.h"
|
||||||
#include "JsonGetUsers.h"
|
#include "JsonGetUsers.h"
|
||||||
#include "JsonLoginViaEmailVerificationCode.h"
|
#include "JsonLoginViaEmailVerificationCode.h"
|
||||||
#include "JsonAdminEmailVerificationResend.h"
|
|
||||||
#include "JsonGetUserInfos.h"
|
#include "JsonGetUserInfos.h"
|
||||||
#include "JsonUpdateUserInfos.h"
|
#include "JsonUpdateUserInfos.h"
|
||||||
#include "JsonUnsecureLogin.h"
|
#include "JsonUnsecureLogin.h"
|
||||||
@ -44,6 +45,9 @@ Poco::Net::HTTPRequestHandler* JsonRequestHandlerFactory::createRequestHandler(c
|
|||||||
if (url_first_part == "/login") {
|
if (url_first_part == "/login") {
|
||||||
return new JsonGetLogin;
|
return new JsonGetLogin;
|
||||||
}
|
}
|
||||||
|
else if (url_first_part == "/checkSessionState") {
|
||||||
|
return new JsonCheckSessionState;
|
||||||
|
}
|
||||||
else if (url_first_part == "/checkTransaction") {
|
else if (url_first_part == "/checkTransaction") {
|
||||||
return new JsonTransaction;
|
return new JsonTransaction;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,8 +12,6 @@
|
|||||||
#include "../SingletonManager/EmailManager.h"
|
#include "../SingletonManager/EmailManager.h"
|
||||||
#include "../SingletonManager/SingletonTaskObserver.h"
|
#include "../SingletonManager/SingletonTaskObserver.h"
|
||||||
|
|
||||||
#include "../tasks/PrepareEmailTask.h"
|
|
||||||
#include "../tasks/SendEmailTask.h"
|
|
||||||
#include "../tasks/SigningTransaction.h"
|
#include "../tasks/SigningTransaction.h"
|
||||||
#include "../tasks/AuthenticatedEncryptionCreateKeyTask.h"
|
#include "../tasks/AuthenticatedEncryptionCreateKeyTask.h"
|
||||||
#include "../tasks/VerificationEmailResendTask.h"
|
#include "../tasks/VerificationEmailResendTask.h"
|
||||||
@ -348,12 +346,14 @@ bool Session::createUser(const std::string& first_name, const std::string& last_
|
|||||||
*/
|
*/
|
||||||
//UniLib::controller::TaskPtr sendEmail(new SendEmailTask(message, ServerConfig::g_CPUScheduler, 1));
|
//UniLib::controller::TaskPtr sendEmail(new SendEmailTask(message, ServerConfig::g_CPUScheduler, 1));
|
||||||
//Email(AutoPtr<controller::EmailVerificationCode> emailVerification, AutoPtr<controller::User> user, EmailType type);
|
//Email(AutoPtr<controller::EmailVerificationCode> emailVerification, AutoPtr<controller::User> user, EmailType type);
|
||||||
UniLib::controller::TaskPtr sendEmail(new SendEmailTask(new model::Email(mEmailVerificationCodeObject, mNewUser, model::EMAIL_USER_VERIFICATION_CODE), ServerConfig::g_CPUScheduler, 1));
|
auto em = EmailManager::getInstance();
|
||||||
|
em->addEmail(new model::Email(mEmailVerificationCodeObject, mNewUser, model::EMAIL_USER_VERIFICATION_CODE));
|
||||||
|
/*UniLib::controller::TaskPtr sendEmail(new SendEmailTask(new model::Email(mEmailVerificationCodeObject, mNewUser, model::EMAIL_USER_VERIFICATION_CODE), ServerConfig::g_CPUScheduler, 1));
|
||||||
//sendEmail->setParentTaskPtrInArray(prepareEmail, 0);
|
//sendEmail->setParentTaskPtrInArray(prepareEmail, 0);
|
||||||
sendEmail->setParentTaskPtrInArray(writeEmailVerification, 0);
|
sendEmail->setParentTaskPtrInArray(writeEmailVerification, 0);
|
||||||
sendEmail->setFinishCommand(new SessionStateUpdateCommand(SESSION_STATE_EMAIL_VERIFICATION_SEND, this));
|
sendEmail->setFinishCommand(new SessionStateUpdateCommand(SESSION_STATE_EMAIL_VERIFICATION_SEND, this));
|
||||||
sendEmail->scheduleTask(sendEmail);
|
sendEmail->scheduleTask(sendEmail);
|
||||||
|
*/
|
||||||
// write user into db
|
// write user into db
|
||||||
// generate and write email verification into db
|
// generate and write email verification into db
|
||||||
// send email
|
// send email
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
#include "PrepareEmailTask.h"
|
|
||||||
#include "../lib/Profiler.h"
|
|
||||||
#include "../ServerConfig.h"
|
|
||||||
#include "../SingletonManager/ErrorManager.h"
|
|
||||||
|
|
||||||
#include "Poco/Net/SSLException.h"
|
|
||||||
|
|
||||||
PrepareEmailTask::PrepareEmailTask(UniLib::controller::CPUSheduler* cpuScheduler)
|
|
||||||
: UniLib::controller::CPUTask(cpuScheduler), mMailClientSession(nullptr)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PrepareEmailTask::~PrepareEmailTask()
|
|
||||||
{
|
|
||||||
if (mMailClientSession) {
|
|
||||||
delete mMailClientSession;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int PrepareEmailTask::run()
|
|
||||||
{
|
|
||||||
if (ServerConfig::g_disableEmail) return 0;
|
|
||||||
Profiler timeUsed;
|
|
||||||
mMailClientSession = new Poco::Net::SecureSMTPClientSession(ServerConfig::g_EmailAccount.url, ServerConfig::g_EmailAccount.port);
|
|
||||||
mMailClientSession->login();
|
|
||||||
try {
|
|
||||||
mMailClientSession->startTLS(ServerConfig::g_SSL_CLient_Context);
|
|
||||||
mMailClientSession->login(Poco::Net::SMTPClientSession::AUTH_LOGIN, ServerConfig::g_EmailAccount.username, ServerConfig::g_EmailAccount.password);
|
|
||||||
} catch(Poco::Net::SSLException& ex) {
|
|
||||||
printf("[PrepareEmailTask] ssl certificate error: %s\nPlease make sure you have cacert.pem (CA/root certificates) next to binary from https://curl.haxx.se/docs/caextract.html\n", ex.displayText().data());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//printf("[PrepareEmailTask] time: %s\n", timeUsed.string().data());
|
|
||||||
/*
|
|
||||||
session.login();
|
|
||||||
session.startTLS(pContext);
|
|
||||||
if (!username.empty())
|
|
||||||
{
|
|
||||||
session.login(SMTPClientSession::AUTH_LOGIN, username, password);
|
|
||||||
}
|
|
||||||
session.sendMessage(message);
|
|
||||||
session.close();
|
|
||||||
*/
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int PrepareEmailTask::send(Poco::Net::MailMessage* message)
|
|
||||||
{
|
|
||||||
if (ServerConfig::g_disableEmail) return 0;
|
|
||||||
|
|
||||||
auto er = ErrorManager::getInstance();
|
|
||||||
try {
|
|
||||||
mMailClientSession->sendMessage(*message);
|
|
||||||
mMailClientSession->close();
|
|
||||||
}
|
|
||||||
catch (Poco::Exception& exc) {
|
|
||||||
er->addError(new ParamError("PrepareEmailTask::send", "error sending email", exc.displayText().data()));
|
|
||||||
printf("[PrepareEmailTask::%s] error sending email: %s\n", __FUNCTION__, exc.displayText().data());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
#ifndef GRADIDO_LOGIN_SERVER_TASKS_PREPAIRE_EMAIL_TASK_INCLUDE
|
|
||||||
#define GRADIDO_LOGIN_SERVER_TASKS_PREPAIRE_EMAIL_TASK_INCLUDE
|
|
||||||
|
|
||||||
#include "CPUTask.h"
|
|
||||||
#include "Poco/Net/SecureSMTPClientSession.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PrepareEmailTask : public UniLib::controller::CPUTask
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PrepareEmailTask(UniLib::controller::CPUSheduler* cpuScheduler);
|
|
||||||
virtual ~PrepareEmailTask();
|
|
||||||
|
|
||||||
virtual int run();
|
|
||||||
int send(Poco::Net::MailMessage* message);
|
|
||||||
virtual const char* getResourceType() const { return "PrepareEmailTask"; };
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
Poco::Net::SecureSMTPClientSession* mMailClientSession;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //GRADIDO_LOGIN_SERVER_TASKS_PREPAIRE_EMAIL_TASK_INCLUDE
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
#include "SendEmailTask.h"
|
|
||||||
#include "PrepareEmailTask.h"
|
|
||||||
#include "../lib/Profiler.h"
|
|
||||||
#include "../SingletonManager/ErrorManager.h"
|
|
||||||
#include "../SingletonManager/EmailManager.h"
|
|
||||||
#include "../ServerConfig.h"
|
|
||||||
|
|
||||||
#include "Poco/Net/MediaType.h"
|
|
||||||
|
|
||||||
SendEmailTask::SendEmailTask(Poco::Net::MailMessage* mailMessage, UniLib::controller::CPUSheduler* cpuScheduler, size_t additionalTaskDependenceCount/* = 0*/)
|
|
||||||
: UniLib::controller::CPUTask(cpuScheduler, additionalTaskDependenceCount+1), mMailMessage(mailMessage), mEmail(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SendEmailTask::SendEmailTask(model::Email*email, UniLib::controller::CPUSheduler* cpuScheduler, size_t additionalTaskDependenceCount/* = 0*/)
|
|
||||||
: UniLib::controller::CPUTask(cpuScheduler, additionalTaskDependenceCount), mMailMessage(nullptr), mEmail(email)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SendEmailTask::~SendEmailTask()
|
|
||||||
{
|
|
||||||
if (mMailMessage) {
|
|
||||||
delete mMailMessage;
|
|
||||||
mMailMessage = nullptr;
|
|
||||||
}
|
|
||||||
if (mEmail) {
|
|
||||||
delete mEmail;
|
|
||||||
mEmail = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int SendEmailTask::run()
|
|
||||||
{
|
|
||||||
if(ServerConfig::g_disableEmail) return 0;
|
|
||||||
|
|
||||||
Profiler timeUsed;
|
|
||||||
auto er = ErrorManager::getInstance();
|
|
||||||
auto parent = getParent(0);
|
|
||||||
|
|
||||||
if (mMailMessage) {
|
|
||||||
|
|
||||||
if (strcmp(parent->getResourceType(), "PrepareEmailTask") != 0) {
|
|
||||||
er->addError(new Error("SendEmailTask", "first parent isn't PrepareEmailTask"));
|
|
||||||
er->sendErrorsAsEmail();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
PrepareEmailTask* prepare = (PrepareEmailTask*)&(*parent);
|
|
||||||
mMailMessage->setSender(ServerConfig::g_EmailAccount.sender);
|
|
||||||
|
|
||||||
if (prepare->send(mMailMessage)) {
|
|
||||||
er->sendErrorsAsEmail();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mEmail) {
|
|
||||||
auto em = EmailManager::getInstance();
|
|
||||||
em->addEmail(mEmail);
|
|
||||||
mEmail = nullptr;
|
|
||||||
}
|
|
||||||
//printf("[SendEmailTask] time: %s\n", timeUsed.string().data());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
#ifndef GRADIDO_LOGIN_SERVER_TASKS_SEND_EMAIL_TASK_INCLUDE
|
|
||||||
#define GRADIDO_LOGIN_SERVER_TASKS_SEND_EMAIL_TASK_INCLUDE
|
|
||||||
|
|
||||||
#include "CPUTask.h"
|
|
||||||
#include "Poco/Net/MailMessage.h"
|
|
||||||
|
|
||||||
#include "../model/email/Email.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @author: Dario Rekowski
|
|
||||||
*
|
|
||||||
* @date: 29.09.19
|
|
||||||
* @desc: Task for send an email, the first parent dependence pointer must be a prepare email task
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
class SendEmailTask : public UniLib::controller::CPUTask
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
SendEmailTask(Poco::Net::MailMessage* mailMessage, UniLib::controller::CPUSheduler* cpuScheduler, size_t additionalTaskDependenceCount = 0);
|
|
||||||
SendEmailTask(model::Email* email, UniLib::controller::CPUSheduler* cpuScheduler, size_t additionalTaskDependenceCount = 0);
|
|
||||||
virtual ~SendEmailTask();
|
|
||||||
|
|
||||||
virtual int run();
|
|
||||||
|
|
||||||
virtual const char* getResourceType() const { return "SendEmailTask"; };
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
Poco::Net::MailMessage* mMailMessage;
|
|
||||||
model::Email* mEmail;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //GRADIDO_LOGIN_SERVER_TASKS_SEND_EMAIL_TASK_INCLUDE
|
|
||||||
@ -13,15 +13,6 @@ server {
|
|||||||
root /var/www/cakephp/webroot;
|
root /var/www/cakephp/webroot;
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
location ~* \.(png|jpg|ico|webp)$ {
|
|
||||||
expires 30d;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~* \.(js|css) {
|
|
||||||
# expires 1d;
|
|
||||||
expires 1d;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_pass community-server:9000;
|
fastcgi_pass community-server:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
@ -68,6 +59,30 @@ server {
|
|||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /vue {
|
||||||
|
|
||||||
|
|
||||||
|
location /vue/sockjs-node {
|
||||||
|
rewrite /vue/(.*) /$1;
|
||||||
|
}
|
||||||
|
location ~* \.(png) {
|
||||||
|
expires 1d;
|
||||||
|
rewrite /vue/(.*) /$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
#rewrite /vue/(.*) /$1 break;
|
||||||
|
|
||||||
|
proxy_pass http://frontend:8080;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.php?$args;
|
try_files $uri $uri/ /index.php?$args;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gradido",
|
"name": "gradido",
|
||||||
"version": "0.9.2",
|
"version": "0.9.4",
|
||||||
"description": "Gradido",
|
"description": "Gradido",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "git@github.com:gradido/gradido.git",
|
"repository": "git@github.com:gradido/gradido.git",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user