From ec8f10059a662eb0cbe5fcac03c81a2fa7b716b8 Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Wed, 8 Jul 2020 15:48:41 +0000 Subject: [PATCH] update search to react on users with public key but not activated account --- src/Controller/AppController.php | 3 ++- src/Controller/StateUsersController.php | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index d2ed6668a..6cb45961a 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -240,7 +240,7 @@ class AppController extends Controller } else { $this->Flash->error(__('Konto ist nicht aktiviert!')); } - //die(json_encode($json)); + die(json_encode($json)); return $this->redirect($this->loginServerUrl . 'account/', 303); } } @@ -253,6 +253,7 @@ class AppController extends Controller } } else { // no login + die("no login"); if(isset($loginServer['path'])) { return $this->redirect($loginServer['path'], 303); } else { diff --git a/src/Controller/StateUsersController.php b/src/Controller/StateUsersController.php index cf66a91b9..b463fd523 100644 --- a/src/Controller/StateUsersController.php +++ b/src/Controller/StateUsersController.php @@ -116,7 +116,7 @@ class StateUsersController extends AppController if($dataJson['state'] != 'success') { if($dataJson['msg'] == 'session not found') { $session->destroy(); - return $this->redirect($this->loginServerUrl . 'account', 303); + return $this->redirect(Router::url('/', true) . 'account', 303); } } //var_dump($dataJson); @@ -155,7 +155,7 @@ class StateUsersController extends AppController if(!isset($pubkeySorted[$pubkey_hex])) { $pubkeySorted[$pubkey_hex] = ['login' => [], 'community' => []]; } - array_push($pubkeySorted[$u['public_hex']]['community'], $u); + array_push($pubkeySorted[$pubkey_hex]['community'], $u); } $finalUserEntrys = []; // detect states @@ -188,23 +188,25 @@ class StateUsersController extends AppController if($user['login'][0]['email_checked'] == true) { $state = 'email activated'; $color = 'primary'; - $l_user = $user['login'][0]; - $finalUser['name'] = $l_user['first_name'] . ' ' . $l_user['last_name']; - $finalUser['first_name'] = $l_user['first_name']; - $finalUser['last_name'] = $l_user['last_name']; - $finalUser['email'] = $l_user['email']; - $finalUser['created'] = new FrozenTime($l_user['created']); + if(count($user['community']) == 1) { $state = 'account copied to community'; $color = 'success'; //var_dump($user['community'][0]->state_balances[0]['amount']); - } } else { $state = 'email not activated'; $color = 'warning'; } + + $l_user = $user['login'][0]; + $finalUser['name'] = $l_user['first_name'] . ' ' . $l_user['last_name']; + $finalUser['first_name'] = $l_user['first_name']; + $finalUser['last_name'] = $l_user['last_name']; + $finalUser['email'] = $l_user['email']; + $finalUser['created'] = new FrozenTime($l_user['created']); + } else { $state = 'account multiple times on login-server'; $color = 'danger';