WIP styles login Server / profile

This commit is contained in:
Christine Slotty 2020-07-10 18:26:06 +02:00
parent 994fc42fac
commit f1dff9de4f
21 changed files with 30372 additions and 688 deletions

75
account-checkEmail.html Normal file
View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Gradido Login Server: Email Verification</title>
<link rel="stylesheet" type="text/css" href="http://192.168.178.52/css/main.css">
</head>
<body>
<div class="layout">
<div class="center-form-single">
<div class="center-form-header">
<a href="http://192.168.178.52/" class="center-logo">
<picture>
<source srcset="http://192.168.178.52/img/logo_schrift.webp" type="image/webp">
<source srcset="http://192.168.178.52/img/logo_schrift.png" type="image/png">
<img src="http://192.168.178.52/img/logo_schrift.png" alt="logo" />
</picture>
</a>
</div>
<div class="center-form-container">
<div class="center-form-selectors">
<form action="http://192.168.178.52/account/checkEmail" method="GET">
<button id="flag-germany" name="lang" value="de" title="Deutsch" type="submit" class="flag-btn">
<span class="flag flag-germany"></span>
</button>
<button id="flag-england" name="lang" value="en" title="English" type="submit" class="flag-btn">
<span class="flag flag-england"></span>
</button>
</form>
</div>
<div class="center-form-title">
<h1>E-Mail verifizieren</h1>
</div>
<div class="center-form-form">
<form action="http://192.168.178.52/account/checkEmail" method="GET">
<label class="form-label" for="email-verification-code">
Bitte gib deinen E-Mail Verification Code ein:
</label>
<input
class="form-control"
type="number"
name="email-verification-code"
id="email-verification-code"
placeholder="Email Verification Code">
<button type="submit" class="center-form-submit form-button">&Uuml;berpr&uuml;fe Code</button>
</form>
</div>
<div class="center-form-bottom">
<div class="signup-link">
<p class="margin-top-10">
Funktioniert dein E-Mail Verification Code nicht?<br>
Schicke uns eine E-Mail und wir k&uuml;mmern uns darum: <br>
<b><a href="mailto:webmaster@software-labor.de?subject=Invalid E-Mail Verification Code&amp;body=Hallo Dario,%0D%0A%0D%0Amein E-Mail Verification-Code: 0 funktioniert nicht,%0D%0Akannst du das prüfen?%0D%0A%0D%0AMit freundlichen Grüßen%0D%0A">E-Mail an Support schicken</a></b>
</p>
</div>
</div>
</div>
<div class="center-bottom">
<p>Copyright © Gradido 2020</p>
</div>
</div>
<div class="bottomleft">
428 micro s
</div>
<div class="bottomright">
<p>Login Server in Entwicklung</p>
<p>Alpha 0.20.07.10</p>
</div>
</div>
</body>
</html>

67
account-login.html Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Gradido Login Server: Login</title>
<link rel="stylesheet" type="text/css" href="http://192.168.178.52/css/main.css">
</head>
<body>
<div class="layout">
<div class="center-form-single">
<div class="center-form-header">
<a href="http://192.168.178.52/" class="center-logo">
<picture>
<source srcset="http://192.168.178.52/img/logo_schrift.webp" type="image/webp">
<source srcset="http://192.168.178.52/img/logo_schrift.png" type="image/png">
<img src="http://192.168.178.52/img/logo_schrift.png" alt="logo" />
</picture>
</a>
</div>
<div class="center-form-container">
<div class="center-form-selectors">
<form method="GET" action="">
<button id="flag-germany" name="lang" value="de" title="Deutsch" type="submit" class="flag-btn">
<span class="flag flag-germany"></span>
</button>
<button id="flag-england" name="lang" value="en" title="English" type="submit" class="flag-btn">
<span class="flag flag-england"></span>
</button>
</form>
</div>
<div class="center-form-form">
<form action="http://192.168.178.52/account/" method="POST">
<input type="text" class="form-control" name="login-email" placeholder="E-Mail" value="" />
<input type="password" class="form-control" name="login-password" placeholder="Passwort" />
<button type="submit" name="submit" class="center-form-submit form-button">Anmeldung</button>
</form>
</div>
<div class="center-form-bottom">
<div class="signup-link">
<p>Du hast noch kein Gradido-Konto?</p>
<a href="http://192.168.178.52/account/registerDirect">
Neues Konto erstellen
</a>
</div>
<div class="reset-pwd-link">
<a href="http://192.168.178.52/account/resetPassword">Passwort vergessen</a>
</div>
</div>
</div>
<div class="center-bottom">
<p>Copyright © Gradido 2020</p>
</div>
</div>
<div class="bottomleft">
428 micro s
</div>
<div class="bottomright">
<p>Login Server in Entwicklung</p>
<p>Alpha 0.20.07.10</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Gradido Login Server: Registrierung</title>
<link rel="stylesheet" type="text/css" href="http://192.168.178.52/css/main.css">
</head>
<body>
<div class="layout">
<div class="center-form-single">
<div class="center-form-header">
<a href="http://192.168.178.52/" class="center-logo">
<picture>
<source srcset="http://192.168.178.52/img/logo_schrift.webp" type="image/webp">
<source srcset="http://192.168.178.52/img/logo_schrift.png" type="image/png">
<img src="http://192.168.178.52/img/logo_schrift.png" alt="logo" />
</picture>
</a>
</div>
<div class="center-form-container">
<div class="center-form-title">
<h1>Einen neuen Account anlegen</h1>
</div>
<div class="center-form-form">
<form method="POST">
<p>Bitte gib deine Daten an, um einen Account anzulegen:</p>
<label class="form-label" for="register-first-name">Vorname</label>
<input class="form-control" id="register-first-name" type="text" name="register-first-name" value="" />
<label class="form-label" for="register-last-name">Nachname</label>
<input class="form-control" id="register-last-name" type="text" name="register-last-name" value="" />
<label class="form-label" for="register-email">E-Mail</label>
<input class="form-control" id="register-email" type="email" name="register-email" value="" />
<label class="form-label" for="register-password">Passwort</label>
<input class="form-control" id="register-password" type="password" name="register-password" />
<label class="form-label" for="register-password">Passwort Best&auml;tigung</label>
<input class="form-control" id="register-password2" type="password" name="register-password2" />
<input class="center-form-submit form-button" type="submit" name="submit" value="Anmelden">
</form>
</div>
</div>
<div class="center-bottom">
<p>Copyright © Gradido 2020</p>
</div>
</div>
<div class="bottomleft">
428 micro s
</div>
<div class="bottomright">
<p>Login Server in Entwicklung</p>
<p>Alpha 0.20.07.10</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Gradido Login Server: Passwort vergessen</title>
<link rel="stylesheet" type="text/css" href="http://192.168.178.52/css/main.css">
</head>
<body>
<div class="layout">
<div class="center-form-single">
<div class="center-form-header">
<a href="http://192.168.178.52/" class="center-logo">
<picture>
<source srcset="http://192.168.178.52/img/logo_schrift.webp" type="image/webp">
<source srcset="http://192.168.178.52/img/logo_schrift.png" type="image/png">
<img src="http://192.168.178.52/img/logo_schrift.png" alt="logo" />
</picture>
</a>
</div>
<div class="center-form-container">
<div class="center-form-title">
<h1>Passwort zurücksetzen</h1>
</div>
<div class="center-form-form">
<form action="http://192.168.178.52/account/resetPassword">
<label class="form-label" for="email">Gib bitte hier deine E-Mail Adresse an:</label>
<input class="form-control" type="text" name="email" id="email" placeholder="E-Mail"
value="">
<input class="center-form-submit form-button" type="submit" name="submit" value="Bestätigen">
</form>
</div>
<script type="text/javascript">
function removeGroupInvalidClass() {
var elements = document.getElementsByClassName("group-is-invalid");
if (elements.length > 0) {
elements[0].classList.remove("group-is-invalid");
}
}
</script>
</div>
<div class="center-bottom">
<p>Copyright © Gradido 2020</p>
</div>
</div>
<div class="bottomleft">
428 micro s
</div>
<div class="bottomright">
<p>Login Server in Entwicklung</p>
<p>Alpha 0.20.07.10</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Gradido Login Server: Passwort bestimmen</title>
<link rel="stylesheet" type="text/css" href="http://192.168.178.52/css/main.css">
</head>
<body>
<div class="layout">
<div class="center-form-single">
<div class="center-form-header">
<a href="http://192.168.178.52/" class="center-logo">
<picture>
<source srcset="http://192.168.178.52/img/logo_schrift.webp" type="image/webp">
<source srcset="http://192.168.178.52/img/logo_schrift.png" type="image/png">
<img src="http://192.168.178.52/img/logo_schrift.png" alt="logo" />
</picture>
</a>
</div>
<div class="center-form-container">
<div class="center-form-title">
<h1>Passwort bestimmen</h1>
</div>
<div class="center-form-form">
<form method="POST">
<p>Bitte denke dir ein sicheres Passwort aus, das mindestens 8 Zeichen lang ist, ein Klein- und einen Gro&szlig;buchstaben enth&auml;lt, eine Zahl und eines der folgenden Sonderzeichen: @$!%*?&+-</p>
<label class="form-label" for="register-password">Passwort</label>
<input class="form-control" id="register-password" type="password" name="register-password" />
<label class="form-label" for="register-password2">Passwort Best&auml;tigung</label>
<input class="form-control" id="register-password2" type="password" name="register-password2" />
<input class="center-form-submit form-button" type="submit" name="submit" value="&Auml;nderung(en) speichern">
</form>
</div>
</div>
<div class="center-bottom">
<p>Copyright © Gradido 2020</p>
</div>
</div>
<div class="bottomleft">
428 micro s
</div>
<div class="bottomright">
<p>Login Server in Entwicklung</p>
<p>Alpha 0.20.07.10</p>
</div>
</div>
</body>
</html>

View File

@ -6,7 +6,7 @@ CREATE TABLE `state_users` (
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`first_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`last_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `public_key` (`public_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -33,7 +33,7 @@ use Cake\I18n\I18n;
*/
class AppController extends Controller
{
var $loginServerUrl = '';
/**
* Initialization hook method.
@ -73,7 +73,7 @@ class AppController extends Controller
'userModel' => 'ServerUsers',
]
]
]);
]);
$this->Auth->deny(['index']);
@ -87,29 +87,29 @@ class AppController extends Controller
// load current balance
$session = $this->getRequest()->getSession();
$state_user_id = $session->read('StateUser.id');
if($state_user_id) {
$stateBalancesTable = TableRegistry::getTableLocator()->get('stateBalances');
$stateBalanceQuery = $stateBalancesTable
if ($state_user_id) {
$stateBalancesTable = TableRegistry::getTableLocator()->get('stateBalances');
$stateBalanceQuery = $stateBalancesTable
->find('all')
->select('amount')
->contain(false)
->where(['state_user_id' => $state_user_id]);
if($stateBalanceQuery->count() == 1) {
//var_dump($stateBalanceEntry->first());
$session->write('StateUser.balance', $stateBalanceQuery->first()->amount);
//echo "stateUser.balance: " . $session->read('StateUser.balance');
}
if ($stateBalanceQuery->count() == 1) {
//var_dump($stateBalanceEntry->first());
$session->write('StateUser.balance', $stateBalanceQuery->first()->amount);
//echo "stateUser.balance: " . $session->read('StateUser.balance');
}
}
// load error count
if($state_user_id) {
$stateErrorsTable = TableRegistry::getTableLocator()->get('stateErrors');
$stateErrorQuery = $stateErrorsTable
if ($state_user_id) {
$stateErrorsTable = TableRegistry::getTableLocator()->get('stateErrors');
$stateErrorQuery = $stateErrorsTable
->find('all')
->select('id')
->contain(false)
->where(['state_user_id' => $state_user_id]);
$session->write('StateUser.errorCount', $stateErrorQuery->count());
$session->write('StateUser.errorCount', $stateErrorQuery->count());
}
//echo "initialize";
@ -120,25 +120,23 @@ class AppController extends Controller
$GLOBALS["side"] = $side;
$subside = $this->request->getParam('action');
$passedArguments = $this->request->getParam('pass');
if($passedArguments) {
if ($passedArguments) {
$GLOBALS["passed"] = $passedArguments[0];
}
$GLOBALS["subside"] = $subside;
// server login
if($this->Auth->user('id')) {
$GLOBALS['ServerUser'] = $this->Auth->user();
if ($this->Auth->user('id')) {
$GLOBALS['ServerUser'] = $this->Auth->user();
}
// login server url
$loginServer = Configure::read('LoginServer');
if($loginServer && isset($loginServer['url'])) {
$this->loginServerUrl = $loginServer['url'] . '/';
} else {
$this->loginServerUrl = Router::url('/', true);
}
// login server url
$loginServer = Configure::read('LoginServer');
if ($loginServer && isset($loginServer['url'])) {
$this->loginServerUrl = $loginServer['url'] . '/';
} else {
$this->loginServerUrl = Router::url('/', true);
}
}
protected function requestLogin()
@ -149,118 +147,120 @@ class AppController extends Controller
//$this->Cookie->configKey('User', 'encryption', false);
$session_id = intval($this->request->getCookie('GRADIDO_LOGIN', ''));
$ip = $this->request->clientIp();
if(!$session->check('client_ip')) {
$session->write('client_ip', $ip);
if (!$session->check('client_ip')) {
$session->write('client_ip', $ip);
}
// login server cannot detect host ip
// TODO: update login server, recognize nginx real ip header
$loginServer = Configure::read('LoginServer');
if($session_id != 0) {
$userStored = $session->read('StateUser');
$transactionPendings = $session->read('Transactions.pending');
$transactionExecutings = $session->read('Transaction.executing');
if($session->read('session_id') != $session_id ||
if ($session_id != 0) {
$userStored = $session->read('StateUser');
$transactionPendings = $session->read('Transactions.pending');
$transactionExecutings = $session->read('Transaction.executing');
if ($session->read('session_id') != $session_id ||
( $userStored && (!isset($userStored['id']) || !$userStored['email_checked'])) ||
intval($transactionPendings) > 0 ||
intval($transactionExecutings) > 0 ) {
$http = new Client();
try {
$url = $loginServer['host'] . ':' . $loginServer['port'];
intval($transactionExecutings) > 0) {
$http = new Client();
$response = $http->get($url . '/login', ['session_id' => $session_id]);
$json = $response->getJson();
try {
$url = $loginServer['host'] . ':' . $loginServer['port'];
if(isset($json) && count($json) > 0) {
$response = $http->get($url . '/login', ['session_id' => $session_id]);
$json = $response->getJson();
if($json['state'] === 'success') {
//echo "email checked: " . $json['user']['email_checked'] . "; <br>";
if($session->read('session_id') != $session_id ||
( $userStored && !isset($userStored['id']))) {
$session->destroy();
}
foreach($json['user'] as $key => $value) {
$session->write('StateUser.' . $key, $value );
}
//var_dump($json);
$transactionPendings = $json['Transaction.pending'];
$transactionExecuting = $json['Transaction.executing'];
//echo "read transaction pending: $transactionPendings<br>";
$session->write('Transactions.pending', $transactionPendings);
$session->write('Transaction.executing', $transactionExecuting);
$session->write('session_id', $session_id);
$stateUserTable = TableRegistry::getTableLocator()->get('StateUsers');
if(isset($json['user']['public_hex']) && $json['user']['public_hex'] != '') {
$public_key_bin = hex2bin($json['user']['public_hex']);
$stateUserQuery = $stateUserTable
->find('all')
->where(['public_key' => $public_key_bin])
->contain(['StateBalances']);
if($stateUserQuery->count() == 1) {
$stateUser = $stateUserQuery->first();
if($stateUser->first_name != $json['user']['first_name'] ||
$stateUser->last_name != $json['user']['last_name'] ||
$stateUser->email != $json['user']['email']) {
$stateUser->first_name = $json['user']['first_name'];
$stateUser->last_name = $json['user']['last_name'];
$stateUser->email = $json['user']['email'];
if(!$stateUserTable->save($stateUser)) {
$this->Flash->error(__('error updating state user ' . json_encode($stateUser->errors())));
if (isset($json) && count($json) > 0) {
if ($json['state'] === 'success') {
//echo "email checked: " . $json['user']['email_checked'] . "; <br>";
if ($session->read('session_id') != $session_id ||
( $userStored && !isset($userStored['id']))) {
$session->destroy();
}
foreach ($json['user'] as $key => $value) {
$session->write('StateUser.' . $key, $value);
}
//var_dump($json);
$transactionPendings = $json['Transaction.pending'];
$transactionExecuting = $json['Transaction.executing'];
//echo "read transaction pending: $transactionPendings<br>";
$session->write('Transactions.pending', $transactionPendings);
$session->write('Transaction.executing', $transactionExecuting);
$session->write('session_id', $session_id);
$stateUserTable = TableRegistry::getTableLocator()->get('StateUsers');
if (isset($json['user']['public_hex']) && $json['user']['public_hex'] != '') {
$public_key_bin = hex2bin($json['user']['public_hex']);
$stateUserQuery = $stateUserTable
->find('all')
->where(['public_key' => $public_key_bin])
->contain(['StateBalances']);
if ($stateUserQuery->count() == 1) {
$stateUser = $stateUserQuery->first();
if ($stateUser->first_name != $json['user']['first_name'] ||
$stateUser->last_name != $json['user']['last_name'] ||
//$stateUser->username != $json['user']['username'] ||
// -> throws erro
$stateUser->email != $json['user']['email']) {
$stateUser->first_name = $json['user']['first_name'];
$stateUser->last_name = $json['user']['last_name'];
$stateUser->username = $json['user']['username'];
$stateUser->email = $json['user']['email'];
if (!$stateUserTable->save($stateUser)) {
$this->Flash->error(__('error updating state user ' . json_encode($stateUser->errors())));
}
}
//var_dump($stateUser);
if (count($stateUser->state_balances) > 0) {
$session->write('StateUser.balance', $stateUser->state_balances[0]->amount);
}
$session->write('StateUser.id', $stateUser->id);
//echo $stateUser['id'];
} else {
$newStateUser = $stateUserTable->newEntity();
$newStateUser->public_key = $public_key_bin;
$newStateUser->first_name = $json['user']['first_name'];
$newStateUser->last_name = $json['user']['last_name'];
$newStateUser->username = $json['user']['username'];
$newStateUser->email = $json['user']['email'];
if (!$stateUserTable->save($newStateUser)) {
$this->Flash->error(__('error saving state user ' . json_encode($newStateUser->errors())));
}
$session->write('StateUser.id', $newStateUser->id);
//echo $newStateUser->id;
}
} else {
// we haven't get a pubkey? something seems to gone wrong on the login-server
$this->Flash->error(__('no pubkey'));
//var_dump($json);
return $this->redirect($this->loginServerUrl . 'account/error500/noPubkey', 303);
}
} else {
if ($json['state'] === 'not found') {
$this->Flash->error(__('invalid session'));
} else {
$this->Flash->error(__('Konto ist nicht aktiviert!'));
}
//die(json_encode($json));
return $this->redirect($this->loginServerUrl . 'account/', 303);
}
}
//var_dump($stateUser);
if(count($stateUser->state_balances) > 0) {
$session->write('StateUser.balance', $stateUser->state_balances[0]->amount);
}
$session->write('StateUser.id', $stateUser->id);
//echo $stateUser['id'];
} else {
$newStateUser = $stateUserTable->newEntity();
$newStateUser->public_key = $public_key_bin;
$newStateUser->first_name = $json['user']['first_name'];
$newStateUser->last_name = $json['user']['last_name'];
$newStateUser->email = $json['user']['email'];
if(!$stateUserTable->save($newStateUser)) {
$this->Flash->error(__('error saving state user ' . json_encode($newStateUser->errors())));
}
$session->write('StateUser.id', $newStateUser->id);
//echo $newStateUser->id;
}
} else {
// we haven't get a pubkey? something seems to gone wrong on the login-server
$this->Flash->error(__('no pubkey'));
//var_dump($json);
return $this->redirect($this->loginServerUrl . 'account/error500/noPubkey', 303);
}
} else {
if($json['state'] === 'not found' ) {
$this->Flash->error(__('invalid session'));
} else {
$this->Flash->error(__('Konto ist nicht aktiviert!'));
}
//die(json_encode($json));
return $this->redirect($this->loginServerUrl . 'account/', 303);
} catch (\Exception $e) {
$msg = $e->getMessage();
$this->Flash->error(__('error http request: ') . $msg);
return $this->redirect(['controller' => 'Dashboard', 'action' => 'errorHttpRequest']);
//continue;
}
}
} catch(\Exception $e) {
$msg = $e->getMessage();
$this->Flash->error(__('error http request: ') . $msg);
return $this->redirect(['controller' => 'Dashboard', 'action' => 'errorHttpRequest']);
//continue;
}
}
} else {
// no login
//die("no login");
if(isset($loginServer['path'])) {
return $this->redirect($loginServer['path'], 303);
} else {
return $this->redirect($this->loginServerUrl . 'account/', 303);
}
if (isset($loginServer['path'])) {
return $this->redirect($loginServer['path'], 303);
} else {
return $this->redirect($this->loginServerUrl . 'account/', 303);
}
}
return true;
}
@ -272,60 +272,63 @@ class AppController extends Controller
}
*/
public function addAdminError($controller, $action, array $returnTable, $state_user_id) {
if(!is_array($returnTable)) {
$this->addAdminError('AppController', 'addAdminError', ['state' => 'error', 'msg' => 'returnTable isn\'t array', 'details' => gettype($returnTable)], $state_user_id);
return false;
}
$adminErrorTable = TableRegistry::getTableLocator()->get('AdminErrors');
$adminErrorEntity = $adminErrorTable->newEntity();
$adminErrorEntity->state_user_id = $state_user_id;
$adminErrorEntity->controller = $controller;
$adminErrorEntity->action = $action;
$adminErrorEntity->state = $returnTable['state'];
if(isset($returnTable['msg'])) {
$adminErrorEntity->msg = $returnTable['msg'];
} else {
$adminErrorEntity->msg = __('(Leere Message)');
}
if(isset($returnTable['details'])) {
$adminErrorEntity->details = $returnTable['details'];
} else {
$adminErrorEntity->details = __('(Leere Details)');
}
if(!$adminErrorTable->save($adminErrorEntity)) {
$this->Flash->error(
public function addAdminError($controller, $action, array $returnTable, $state_user_id)
{
if (!is_array($returnTable)) {
$this->addAdminError('AppController', 'addAdminError', ['state' => 'error', 'msg' => 'returnTable isn\'t array', 'details' => gettype($returnTable)], $state_user_id);
return false;
}
$adminErrorTable = TableRegistry::getTableLocator()->get('AdminErrors');
$adminErrorEntity = $adminErrorTable->newEntity();
$adminErrorEntity->state_user_id = $state_user_id;
$adminErrorEntity->controller = $controller;
$adminErrorEntity->action = $action;
$adminErrorEntity->state = $returnTable['state'];
if (isset($returnTable['msg'])) {
$adminErrorEntity->msg = $returnTable['msg'];
} else {
$adminErrorEntity->msg = __('(Leere Message)');
}
if (isset($returnTable['details'])) {
$adminErrorEntity->details = $returnTable['details'];
} else {
$adminErrorEntity->details = __('(Leere Details)');
}
if (!$adminErrorTable->save($adminErrorEntity)) {
$this->Flash->error(
__('Serious error, couldn\'t save to db, please write the admin: ' . $this->getAdminEmailLink()),
['escape' => false]);
}
return true;
}
public function getAdminEmailLink($text = '') {
$serverAdminEmail = Configure::read('ServerAdminEmail');
return '<a href="mailto:' . $serverAdminEmail . '">'. $serverAdminEmail . '</a>';
['escape' => false]
);
}
return true;
}
public function returnJsonEncoded($json) {
$this->autoRender = false;
$response = $this->response->withType('application/json');
return $response->withStringBody($json);
public function getAdminEmailLink($text = '')
{
$serverAdminEmail = Configure::read('ServerAdminEmail');
return '<a href="mailto:' . $serverAdminEmail . '">'. $serverAdminEmail . '</a>';
}
public function returnJson($array) {
$this->autoRender = false;
$response = $this->response->withType('application/json');
return $response->withStringBody(json_encode($array));
public function returnJsonEncoded($json)
{
$this->autoRender = false;
$response = $this->response->withType('application/json');
return $response->withStringBody($json);
}
public function returnJson($array)
{
$this->autoRender = false;
$response = $this->response->withType('application/json');
return $response->withStringBody(json_encode($array));
}
public function getStartEndForMonth($month, $year)
{
$timeString = $year . '-' . $month . '-01 00:00';
$firstDay = new Time($timeString);
$lastDay = new Time($timeString);
$lastDay = $lastDay->addMonth(1);
return [$firstDay, $lastDay];
$timeString = $year . '-' . $month . '-01 00:00';
$firstDay = new Time($timeString);
$lastDay = new Time($timeString);
$lastDay = $lastDay->addMonth(1);
return [$firstDay, $lastDay];
}
}

View File

@ -70,8 +70,8 @@ class StateUsersController extends AppController
public function listIdentHashes()
{
$stateUsers = $this->StateUsers->find('all')->toArray();
foreach($stateUsers as $i => $user) {
$stateUsers[$i]->identHash = TransactionCreation::DRMakeStringHash($user->email);
foreach ($stateUsers as $i => $user) {
$stateUsers[$i]->identHash = TransactionCreation::DRMakeStringHash($user->email);
}
$this->set('stateUsers', $stateUsers);
}
@ -83,12 +83,12 @@ class StateUsersController extends AppController
$this->viewBuilder()->setLayout('frontend');
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $result;
if ($result !== true) {
return $result;
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->redirect(['controller' => 'dashboard', 'action' => 'index']);
if ($user['role'] != 'admin') {
return $this->redirect(['controller' => 'dashboard', 'action' => 'index']);
}
$searchForm = new UserSearchForm();
@ -99,149 +99,151 @@ class StateUsersController extends AppController
$this->set(compact('timeUsed', 'searchForm', 'csfr_token'));
if ($this->request->is('post')) {
$requestData = $this->request->getData();
$requestData = $this->request->getData();
if($searchForm->validate($requestData)) {
//var_dump($requestData);
$searchString = $requestData['search'];
$searchType = 'unknown';
if(GenericValidation::email($searchString, [])) {
$searchType = 'email';
}
// find users on login server
$resultJson = $this->JsonRequestClient->getUsers($session->read('session_id'), $searchString);
$loginServerUser = [];
if($resultJson['state'] == 'success') {
$dataJson = $resultJson['data'];
if($dataJson['state'] != 'success') {
if($dataJson['msg'] == 'session not found') {
$session->destroy();
return $this->redirect(Router::url('/', true) . 'account', 303);
}
}
//var_dump($dataJson);
if(isset($dataJson['users'])) {
$loginServerUser = $dataJson['users'];
}
}
$pubkeySorted = [];
$emptyPubkeys = [];
foreach($loginServerUser as $u) {
if(!isset($u['public_hex']) || $u['public_hex'] == '') {
array_push($emptyPubkeys, $u);
} else {
if(!isset($pubkeySorted[$u['public_hex']])) {
$pubkeySorted[$u['public_hex']] = ['login' => [], 'community' => []];
if ($searchForm->validate($requestData)) {
//var_dump($requestData);
$searchString = $requestData['search'];
$searchType = 'unknown';
if (GenericValidation::email($searchString, [])) {
$searchType = 'email';
}
array_push($pubkeySorted[$u['public_hex']]['login'], $u);
}
}
// find user on community server db
$globalSearch = '%' . $searchString . '%';
$communityUsers = $this->StateUsers
// find users on login server
$resultJson = $this->JsonRequestClient->getUsers($session->read('session_id'), $searchString);
$loginServerUser = [];
if ($resultJson['state'] == 'success') {
$dataJson = $resultJson['data'];
if ($dataJson['state'] != 'success') {
if ($dataJson['msg'] == 'session not found') {
$session->destroy();
return $this->redirect(Router::url('/', true) . 'account', 303);
}
}
//var_dump($dataJson);
if (isset($dataJson['users'])) {
$loginServerUser = $dataJson['users'];
}
}
$pubkeySorted = [];
$emptyPubkeys = [];
foreach ($loginServerUser as $u) {
if (!isset($u['public_hex']) || $u['public_hex'] == '') {
array_push($emptyPubkeys, $u);
} else {
if (!isset($pubkeySorted[$u['public_hex']])) {
$pubkeySorted[$u['public_hex']] = ['login' => [], 'community' => []];
}
array_push($pubkeySorted[$u['public_hex']]['login'], $u);
}
}
// find user on community server db
$globalSearch = '%' . $searchString . '%';
$communityUsers = $this->StateUsers
->find('all')
->contain(['StateBalances' => ['fields' => ['amount', 'state_user_id']]]);
$communityUsers->where(['OR' => [
$communityUsers->where(['OR' => [
'first_name LIKE' => $globalSearch,
'last_name LIKE' => $globalSearch,
'username LIKE' => $globalSearch,
'email LIKE' => $globalSearch
]]);
]]);
//var_dump($communityUsers->toArray());
foreach($communityUsers as $u) {
$pubkey_hex = bin2hex(stream_get_contents($u->public_key));
$u->public_hex = $pubkey_hex;
if(!isset($pubkeySorted[$pubkey_hex])) {
$pubkeySorted[$pubkey_hex] = ['login' => [], 'community' => []];
}
array_push($pubkeySorted[$pubkey_hex]['community'], $u);
}
$finalUserEntrys = [];
// detect states
foreach($pubkeySorted as $pubhex => $user) {
$finalUser = [];
$state = 'account created';
$color = 'secondary';
$finalUser['balance'] = 0;
$finalUser['pubkeyhex'] = $pubhex;
$finalUser['created'] = null;
if(count($user['community']) == 1) {
if(isset($user['community'][0]->state_balances) &&
isset($user['community'][0]->state_balances[0]['amount'])) {
$finalUser['balance'] = $user['community'][0]->state_balances[0]->amount;
//var_dump($communityUsers->toArray());
foreach ($communityUsers as $u) {
$pubkey_hex = bin2hex(stream_get_contents($u->public_key));
$u->public_hex = $pubkey_hex;
if (!isset($pubkeySorted[$pubkey_hex])) {
$pubkeySorted[$pubkey_hex] = ['login' => [], 'community' => []];
}
array_push($pubkeySorted[$pubkey_hex]['community'], $u);
}
}
$finalUserEntrys = [];
// detect states
foreach ($pubkeySorted as $pubhex => $user) {
$finalUser = [];
$state = 'account created';
$color = 'secondary';
$finalUser['balance'] = 0;
$finalUser['pubkeyhex'] = $pubhex;
$finalUser['created'] = null;
if(count($user['login']) == 0) {
$state = 'account not on login-server';
$color = 'danger';
if(count($user['community']) == 1) {
$c_user = $user['community'][0];
$finalUser['name'] = $c_user->first_name . ' ' . $c_user->last_name;
$finalUser['first_name'] = $c_user->first_name;
$finalUser['last_name'] = $c_user->last_name;
$finalUser['email'] = $c_user->email;
}
} else if(count($user['login']) == 1) {
if($user['login'][0]['email_checked'] == true) {
$state = 'email activated';
$color = 'primary';
if(count($user['community']) == 1) {
$state = 'account copied to community';
$color = 'success';
//var_dump($user['community'][0]->state_balances[0]['amount']);
}
if (count($user['community']) == 1) {
if (isset($user['community'][0]->state_balances) &&
isset($user['community'][0]->state_balances[0]['amount'])) {
$finalUser['balance'] = $user['community'][0]->state_balances[0]->amount;
}
}
} else {
$state = 'email not activated';
$color = 'warning';
if (count($user['login']) == 0) {
$state = 'account not on login-server';
$color = 'danger';
if (count($user['community']) == 1) {
$c_user = $user['community'][0];
$finalUser['name'] = $c_user->first_name . ' ' . $c_user->last_name;
$finalUser['first_name'] = $c_user->first_name;
$finalUser['last_name'] = $c_user->last_name;
$finalUser['username'] = $c_user->username;
$finalUser['email'] = $c_user->email;
}
} elseif (count($user['login']) == 1) {
if ($user['login'][0]['email_checked'] == true) {
$state = 'email activated';
$color = 'primary';
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['username'] = $l_user['username'];
$finalUser['email'] = $l_user['email'];
$finalUser['created'] = new FrozenTime($l_user['created']);
} else {
$state = 'account multiple times on login-server';
$color = 'danger';
}
$finalUser['indicator'] = ['name' => $state, 'color' => $color];
array_push($finalUserEntrys, $finalUser);
}
$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';
}
$finalUser['indicator'] = ['name' => $state, 'color' => $color];
array_push($finalUserEntrys, $finalUser);
foreach ($emptyPubkeys as $user) {
$finalUser = [];
$state = 'account not on community server';
$color = 'secondary';
if ($user['email_checked'] == false) {
$state = 'email not activated';
$color = 'warning';
} else {
$state = 'no keys';
$color = 'warning';
}
$finalUser['balance'] = 0;
$finalUser['pubkeyhex'] = '';
$finalUser['name'] = $user['first_name'] . ' ' . $user['last_name'];
$finalUser['first_name'] = $user['first_name'];
$finalUser['last_name'] = $user['last_name'];
$finalUser['username'] = $user['username'];
$finalUser['email'] = $user['email'];
$finalUser['created'] = new FrozenTime($user['created']);
$finalUser['indicator'] = ['name' => $state, 'color' => $color];
array_push($finalUserEntrys, $finalUser);
}
//var_dump($pubkeySorted);
} else {
$this->Flash->error(__('Something was invalid, please try again!'));
}
foreach($emptyPubkeys as $user) {
$finalUser = [];
$state = 'account not on community server';
$color = 'secondary';
if($user['email_checked'] == false) {
$state = 'email not activated';
$color = 'warning';
} else {
$state = 'no keys';
$color = 'warning';
}
$finalUser['balance'] = 0;
$finalUser['pubkeyhex'] = '';
$finalUser['name'] = $user['first_name'] . ' ' . $user['last_name'];
$finalUser['first_name'] = $user['first_name'];
$finalUser['last_name'] = $user['last_name'];
$finalUser['email'] = $user['email'];
$finalUser['created'] = new FrozenTime($user['created']);
$finalUser['indicator'] = ['name' => $state, 'color' => $color];
array_push($finalUserEntrys, $finalUser);
}
//var_dump($pubkeySorted);
} else {
$this->Flash->error(__('Something was invalid, please try again!'));
}
$this->set('finalUserEntrys', $finalUserEntrys);
$this->set('finalUserEntrys', $finalUserEntrys);
}
$timeUsed = microtime(true) - $startTime;
$this->set('timeUsed', $timeUsed);
@ -249,189 +251,187 @@ class StateUsersController extends AppController
public function ajaxCopyCommunityToLogin()
{
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if ($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if ($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if ($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
}
public function ajaxCopyLoginToCommunity()
{
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if ($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if ($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
//$user = $jsonData['user'];
//var_dump($jsonData);
if ($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
//$user = $jsonData['user'];
//var_dump($jsonData);
$newStateUser = $this->StateUsers->newEntity();
$this->StateUsers->patchEntity($newStateUser, $jsonData);
$newStateUser->public_key = hex2bin($jsonData['pubkeyhex']);
$newStateUser = $this->StateUsers->newEntity();
$this->StateUsers->patchEntity($newStateUser, $jsonData);
$newStateUser->public_key = hex2bin($jsonData['pubkeyhex']);
if(!$this->StateUsers->save($newStateUser)) {
return $this->returnJson(['state' => 'error', 'msg' => 'error by saving', 'details' => json_encode($newStateUser->errors())]);
}
if (!$this->StateUsers->save($newStateUser)) {
return $this->returnJson(['state' => 'error', 'msg' => 'error by saving', 'details' => json_encode($newStateUser->errors())]);
}
return $this->returnJson(['state' => 'success']);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
return $this->returnJson(['state' => 'success']);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
}
public function ajaxVerificationEmailResend()
{
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
$email = $jsonData['email'];
$session_id = $session->read('session_id');
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if ($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if ($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if ($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
$email = $jsonData['email'];
$session_id = $session->read('session_id');
return $this->returnJson($this->JsonRequestClient->sendRequest(json_encode([
return $this->returnJson($this->JsonRequestClient->sendRequest(json_encode([
'session_id' => $session_id,
'email' => $email
]), '/adminEmailVerificationResend'));
/*return $this->sendRequest(json_encode([
]), '/adminEmailVerificationResend'));
/*return $this->sendRequest(json_encode([
'session_id' => $session_id,
'search' => $searchString
]), '/getUsers');*/
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
]), '/getUsers');*/
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
}
public function ajaxGetUserEmailVerificationCode()
{
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
$email = $jsonData['email'];
$session_id = $session->read('session_id');
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if ($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if ($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if ($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
$email = $jsonData['email'];
$session_id = $session->read('session_id');
return $this->returnJson($this->JsonRequestClient->sendRequest(json_encode([
return $this->returnJson($this->JsonRequestClient->sendRequest(json_encode([
'session_id' => $session_id,
'email' => $email,
'ask' => ['EmailVerificationCode.Register', 'loginServer.path']
]), '/getUserInfos'));
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
]), '/getUserInfos'));
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
}
public function ajaxDelete()
{
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if ($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if ($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
//$user = $jsonData['user'];
//var_dump($jsonData);
$pubkey = hex2bin($jsonData['pubkeyhex']);
$stateUsers = $this->StateUsers->find('all')->where(['public_key' => $pubkey]);
if($stateUsers->count() != 1) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid result count']);
}
if ($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
//$user = $jsonData['user'];
//var_dump($jsonData);
$pubkey = hex2bin($jsonData['pubkeyhex']);
$stateUsers = $this->StateUsers->find('all')->where(['public_key' => $pubkey]);
if ($stateUsers->count() != 1) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid result count']);
}
if ($this->StateUsers->delete($stateUsers->first())) {
return $this->returnJson(['state' => 'success']);
} else {
return $this->returnJson(['state' => 'error', 'msg' => 'error by deleting', 'details' => json_encode($stateUser->errors())]);
}
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
if ($this->StateUsers->delete($stateUsers->first())) {
return $this->returnJson(['state' => 'success']);
} else {
return $this->returnJson(['state' => 'error', 'msg' => 'error by deleting', 'details' => json_encode($stateUser->errors())]);
}
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
}
public function ajaxCountTransactions()
{
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
$session = $this->getRequest()->getSession();
$result = $this->requestLogin();
if ($result !== true) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid session']);
}
$user = $session->read('StateUser');
if ($user['role'] != 'admin') {
return $this->returnJson(['state' => 'error', 'msg' => 'not an admin']);
}
if($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
//$user = $jsonData['user'];
//var_dump($jsonData);
$pubkey = hex2bin($jsonData['pubkeyhex']);
$stateUsers = $this->StateUsers
if ($this->request->is('post')) {
$jsonData = $this->request->input('json_decode', true);
//$user = $jsonData['user'];
//var_dump($jsonData);
$pubkey = hex2bin($jsonData['pubkeyhex']);
$stateUsers = $this->StateUsers
->find('all')
->where(['public_key' => $pubkey])
->select(['id']);
if($stateUsers->count() != 1) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid result count']);
}
$stateUser = $stateUsers->first();
//var_dump($stateUser);
//var_dump($stateUser->toArray());
$creationsTable = TableRegistry::getTableLocator()->get('TransactionCreations');
$creationTransactions = $creationsTable
if ($stateUsers->count() != 1) {
return $this->returnJson(['state' => 'error', 'msg' => 'invalid result count']);
}
$stateUser = $stateUsers->first();
//var_dump($stateUser);
//var_dump($stateUser->toArray());
$creationsTable = TableRegistry::getTableLocator()->get('TransactionCreations');
$creationTransactions = $creationsTable
->find('all')
->select(['id'])
->where(['state_user_id' => $stateUser->id]);
$transferTable = TableRegistry::getTableLocator()->get('TransactionSendCoins');
$transferTransactions = $transferTable
$transferTable = TableRegistry::getTableLocator()->get('TransactionSendCoins');
$transferTransactions = $transferTable
->find('all')
->where(['OR' => ['state_user_id' => $stateUser->id, 'receiver_user_id' => $stateUser->id]])
->select(['state_user_id', 'receiver_user_id']);
$counts = ['creation' => $creationTransactions->count(), 'receive' => 0, 'sended' => 0];
foreach($transferTransactions as $transfer) {
//var_dump($transfer);
if($transfer->state_user_id == $stateUser->id) {
$counts['sended']++;
$counts = ['creation' => $creationTransactions->count(), 'receive' => 0, 'sended' => 0];
foreach ($transferTransactions as $transfer) {
//var_dump($transfer);
if ($transfer->state_user_id == $stateUser->id) {
$counts['sended']++;
}
if ($transfer->receiver_user_id == $stateUser->id) {
$counts['receive']++;
}
}
if($transfer->receiver_user_id == $stateUser->id) {
$counts['receive']++;
}
}
return $this->returnJson(['state' => 'success', 'counts' => $counts]);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
return $this->returnJson(['state' => 'success', 'counts' => $counts]);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
}
/*

View File

@ -36,7 +36,7 @@ class StateUser extends Entity
'email' => true,
'first_name' => true,
'last_name' => true,
'user_name' => true,
'username' => true,
'index' => true,
'state_group' => true,
'state_balances' => true,

View File

@ -29,10 +29,6 @@ $this->assign(
<span class="fact label">E-Mail Adresse:</span>
<span class="fact"><?=$user['email']?></span>
</li>
<li class="fact">
<span class="fact label">Benutzername:</span>
<span class="fact"><?=$user['user_name']?></span><!-- xxx editable -->
</li>
<li class="fact">
<span class="fact label">Vorname:</span>
<span class="fact"><?=$user['first_name']?></span><!-- xxx editable -->

View File

@ -30,6 +30,7 @@
<th scope="col"><?= $this->Paginator->sort('state_group_id') ?></th>-->
<th scope="col"><?= $this->Paginator->sort('first_name') ?>
<th scope="col"><?= $this->Paginator->sort('last_name') ?>
<th scope="col"><?= $this->Paginator->sort('username') ?>
<th scope="col"><?= $this->Paginator->sort('email') ?>
<th scope="col" class="actions"><?= __('Actions') ?></th>
</tr>
@ -42,6 +43,7 @@
<td><?= $stateUser->has('state_group') ? $this->Html->link($stateUser->state_group->name, ['controller' => 'StateGroups', 'action' => 'view', $stateUser->state_group->id]) : '' ?></td>-->
<td><?= $stateUser->first_name ?></td>
<td><?= $stateUser->last_name ?></td>
<td><?= $stateUser->username ?></td>
<td><?= $stateUser->email ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $stateUser->id]) ?>

View File

@ -60,6 +60,7 @@
grid-area: header;
}
}
.center-form-single,
.content {
grid-area: center;
grid-row-start: line2;
@ -280,6 +281,12 @@
a.grd_invisible_link:hover {
color: grey;
}
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled),
button:not(:disabled) {
cursor: pointer;
}
}
@media screen and (max-width:767px) {
.bottomright {
@ -965,7 +972,7 @@ and open the template in the editor.
}
/* ============================================================
Screen styles for center part.
Screen styles for the regular center part.
Datei : center.css
Datum : 2020-04-30
@ -1130,6 +1137,131 @@ and open the template in the editor.
}
}
/* Ende @media screen */
/* ============================================================
Screen styles for the simple center form. (login etc)
Datei : center-form-single.css
Datum : 2020-07-10
Autor : Christine Slotty
Copyright : Gradio
============================================================*/
@media screen {
.center-form-single {
width: 50%;
margin: auto;
}
.center-form-header {
margin-bottom: 50px;
}
.center-logo {
display: block;
margin: 0 auto;
width: 280px;
}
.center-logo img {
width: 100%;
vertical-align: middle;
border-style: none;
}
.center-form-container {
display: flex;
flex-direction: column;
padding: 2em 8em;
background-color: #fff;
border-radius: 6px;
box-shadow: 0 0 10px 0 rgba(183, 192, 206, 0.2);
margin-bottom: 1.5rem;
border: 1px solid rgba(238, 238, 238, 0.75);
}
.center-form-selectors {
display: flex;
justify-content: flex-end;
align-items: center;
height: 38px;
padding: 5px 0;
}
.center-form-form .form-control {
margin: auto;
}
.center-form-submit {
display: block;
width: 96%;
margin: auto;
}
.reset-pwd-link,
.signup-link {
padding: 0 20px;
}
.reset-pwd-link a,
.signup-link a {
color: #047006;
}
.reset-pwd-link p,
.signup-link p {
display: inline-block;
margin-block-start: 0;
margin-block-end: 0;
}
.center-bottom {
color: grey;
text-align: center;
padding-top: 30px;
}
.flag-btn {
text-align: center;
vertical-align: middle;
padding: 3px 11px;
}
.flag {
display: block;
}
.flag-germany {
background: red;
border-top: 9px solid #000;
border-bottom: 9px solid #fc0;
width: 40px;
height: 10px;
}
.flag-england {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGlkPSJmbGFnLWljb24tY3NzLWdiIiB2aWV3Qm94PSIwIDAgNjQwIDQ4MCI+CiAgPHBhdGggZmlsbD0iIzAxMjE2OSIgZD0iTTAgMGg2NDB2NDgwSDB6Ii8+CiAgPHBhdGggZmlsbD0iI0ZGRiIgZD0iTTc1IDBsMjQ0IDE4MUw1NjIgMGg3OHY2Mkw0MDAgMjQxbDI0MCAxNzh2NjFoLTgwTDMyMCAzMDEgODEgNDgwSDB2LTYwbDIzOS0xNzhMMCA2NFYwaDc1eiIvPgogIDxwYXRoIGZpbGw9IiNDODEwMkUiIGQ9Ik00MjQgMjgxbDIxNiAxNTl2NDBMMzY5IDI4MWg1NXptLTE4NCAyMGw2IDM1TDU0IDQ4MEgwbDI0MC0xNzl6TTY0MCAwdjNMMzkxIDE5MWwyLTQ0TDU5MCAwaDUwek0wIDBsMjM5IDE3NmgtNjBMMCA0MlYweiIvPgogIDxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yNDEgMHY0ODBoMTYwVjBIMjQxek0wIDE2MHYxNjBoNjQwVjE2MEgweiIvPgogIDxwYXRoIGZpbGw9IiNDODEwMkUiIGQ9Ik0wIDE5M3Y5Nmg2NDB2LTk2SDB6TTI3MyAwdjQ4MGg5NlYwaC05NnoiLz4KPC9zdmc+Cg==);
background-size: cover;
width: 40px;
height: 28px;
}
.group {
padding-left: 10px;
padding-top: 10px;
padding-bottom: 10px;
}
.group-is-invalid {
background-color: rgba(240, 130, 95, 0.2);
border-color: #dc3545;
padding-right: calc(1.5em + 0.75rem);
background-image: url("data:image/svg+xml,%3csvg xmlns=!string!fill=!string!viewBox=!string!%3e%3cpath stroke=!string!d=!string!/%3e%3ccircle r=!string!/%3e%3ccircle cx=!string!r=!string!/%3e%3ccircle cy=!string!r=!string!/%3e%3ccircle cx=!string!cy=!string!r=!string!/%3e%3c/svg%3E");
background-repeat: no-repeat;
background-position: center right calc(0.375em + 0.1875rem);
background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}
.group-is-invalid .radio label .input-frame::before {
border-color: red;
}
}
@media screen and (max-width:767px) {
.center-form-header {
margin-bottom: 30px;
margin-top: -50px;
}
.center-form-single {
width: 97%;
margin: auto;
}
.center-form-container {
padding: 1em 0.5em;
}
}
/* Ende @media screen */
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
@ -1495,6 +1627,7 @@ and open the template in the editor.
.center-form {
width: 450px;
}
.center-form-form .form-control,
.center-form .form-control {
width: 90%;
}
@ -1512,80 +1645,3 @@ and open the template in the editor.
text-align: left;
}
}
/*
Button
.grd-form-bn:hover,
.grd-active {
background-color: @button-background-active;
border-color: @button-border-color;
}
.grd-form-bn {
padding: 5px;
border: 1px solid @form-button-border;
display: table-cell;
text-align: center;
vertical-align: middle;
color: @form-button-text;
}
.grd-form-bn-small {
}
a.grd-form-bn,
a.grd-form-bn:visited {
color: @button-text;
text-decoration: none;
}
.grd-form-bn-succeed {
background-color: @success-background;
color: @success;
margin-top: 3px;
margin-bottom: 3px;
}
.grd-form-bn-succeed:not([disabled]):hover {
background-color: @success-background-hover;
}
.grd-form-bn-discard {
margin-left: 5px;
border: 1px solid @error;
color: @error;
cursor: pointer;
}
form elements
.grd_textarea {
border: 1px solid grey;
background-color: @form-text-background;
padding: 5px;
font-style: italic;
}
.grd-input label {
display: block;
}
input.grd-privkey {
width: 465px;
}
input.grd-pubkey {
width: 465px;
}
input.grd-non-der-keys {
width: 900px;
}
input:not([type='radio']) {
width: 200px;
}
label:not(.grd_radio_label) {
width: 80px;
display: inline-block;
}
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,7 @@
grid-area: header;
}
}
.center-form-single,
.content {
grid-area: center;
grid-row-start: line2;
@ -280,6 +281,12 @@
a.grd_invisible_link:hover {
color: grey;
}
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled),
button:not(:disabled) {
cursor: pointer;
}
}
@media screen and (max-width:767px) {
.bottomright {
@ -965,7 +972,7 @@ and open the template in the editor.
}
/* ============================================================
Screen styles for center part.
Screen styles for the regular center part.
Datei : center.css
Datum : 2020-04-30
@ -1130,6 +1137,131 @@ and open the template in the editor.
}
}
/* Ende @media screen */
/* ============================================================
Screen styles for the simple center form. (login etc)
Datei : center-form-single.css
Datum : 2020-07-10
Autor : Christine Slotty
Copyright : Gradio
============================================================*/
@media screen {
.center-form-single {
width: 50%;
margin: auto;
}
.center-form-header {
margin-bottom: 50px;
}
.center-logo {
display: block;
margin: 0 auto;
width: 280px;
}
.center-logo img {
width: 100%;
vertical-align: middle;
border-style: none;
}
.center-form-container {
display: flex;
flex-direction: column;
padding: 2em 8em;
background-color: #fff;
border-radius: 6px;
box-shadow: 0 0 10px 0 rgba(183, 192, 206, 0.2);
margin-bottom: 1.5rem;
border: 1px solid rgba(238, 238, 238, 0.75);
}
.center-form-selectors {
display: flex;
justify-content: flex-end;
align-items: center;
height: 38px;
padding: 5px 0;
}
.center-form-form .form-control {
margin: auto;
}
.center-form-submit {
display: block;
width: 96%;
margin: auto;
}
.reset-pwd-link,
.signup-link {
padding: 0 20px;
}
.reset-pwd-link a,
.signup-link a {
color: #047006;
}
.reset-pwd-link p,
.signup-link p {
display: inline-block;
margin-block-start: 0;
margin-block-end: 0;
}
.center-bottom {
color: grey;
text-align: center;
padding-top: 30px;
}
.flag-btn {
text-align: center;
vertical-align: middle;
padding: 3px 11px;
}
.flag {
display: block;
}
.flag-germany {
background: red;
border-top: 9px solid #000;
border-bottom: 9px solid #fc0;
width: 40px;
height: 10px;
}
.flag-england {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGlkPSJmbGFnLWljb24tY3NzLWdiIiB2aWV3Qm94PSIwIDAgNjQwIDQ4MCI+CiAgPHBhdGggZmlsbD0iIzAxMjE2OSIgZD0iTTAgMGg2NDB2NDgwSDB6Ii8+CiAgPHBhdGggZmlsbD0iI0ZGRiIgZD0iTTc1IDBsMjQ0IDE4MUw1NjIgMGg3OHY2Mkw0MDAgMjQxbDI0MCAxNzh2NjFoLTgwTDMyMCAzMDEgODEgNDgwSDB2LTYwbDIzOS0xNzhMMCA2NFYwaDc1eiIvPgogIDxwYXRoIGZpbGw9IiNDODEwMkUiIGQ9Ik00MjQgMjgxbDIxNiAxNTl2NDBMMzY5IDI4MWg1NXptLTE4NCAyMGw2IDM1TDU0IDQ4MEgwbDI0MC0xNzl6TTY0MCAwdjNMMzkxIDE5MWwyLTQ0TDU5MCAwaDUwek0wIDBsMjM5IDE3NmgtNjBMMCA0MlYweiIvPgogIDxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yNDEgMHY0ODBoMTYwVjBIMjQxek0wIDE2MHYxNjBoNjQwVjE2MEgweiIvPgogIDxwYXRoIGZpbGw9IiNDODEwMkUiIGQ9Ik0wIDE5M3Y5Nmg2NDB2LTk2SDB6TTI3MyAwdjQ4MGg5NlYwaC05NnoiLz4KPC9zdmc+Cg==);
background-size: cover;
width: 40px;
height: 28px;
}
.group {
padding-left: 10px;
padding-top: 10px;
padding-bottom: 10px;
}
.group-is-invalid {
background-color: rgba(240, 130, 95, 0.2);
border-color: #dc3545;
padding-right: calc(1.5em + 0.75rem);
background-image: url("data:image/svg+xml,%3csvg xmlns=!string!fill=!string!viewBox=!string!%3e%3cpath stroke=!string!d=!string!/%3e%3ccircle r=!string!/%3e%3ccircle cx=!string!r=!string!/%3e%3ccircle cy=!string!r=!string!/%3e%3ccircle cx=!string!cy=!string!r=!string!/%3e%3c/svg%3E");
background-repeat: no-repeat;
background-position: center right calc(0.375em + 0.1875rem);
background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}
.group-is-invalid .radio label .input-frame::before {
border-color: red;
}
}
@media screen and (max-width:767px) {
.center-form-header {
margin-bottom: 30px;
margin-top: -50px;
}
.center-form-single {
width: 97%;
margin: auto;
}
.center-form-container {
padding: 1em 0.5em;
}
}
/* Ende @media screen */
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
@ -1495,6 +1627,7 @@ and open the template in the editor.
.center-form {
width: 450px;
}
.center-form-form .form-control,
.center-form .form-control {
width: 90%;
}
@ -1512,80 +1645,3 @@ and open the template in the editor.
text-align: left;
}
}
/*
Button
.grd-form-bn:hover,
.grd-active {
background-color: @button-background-active;
border-color: @button-border-color;
}
.grd-form-bn {
padding: 5px;
border: 1px solid @form-button-border;
display: table-cell;
text-align: center;
vertical-align: middle;
color: @form-button-text;
}
.grd-form-bn-small {
}
a.grd-form-bn,
a.grd-form-bn:visited {
color: @button-text;
text-decoration: none;
}
.grd-form-bn-succeed {
background-color: @success-background;
color: @success;
margin-top: 3px;
margin-bottom: 3px;
}
.grd-form-bn-succeed:not([disabled]):hover {
background-color: @success-background-hover;
}
.grd-form-bn-discard {
margin-left: 5px;
border: 1px solid @error;
color: @error;
cursor: pointer;
}
form elements
.grd_textarea {
border: 1px solid grey;
background-color: @form-text-background;
padding: 5px;
font-style: italic;
}
.grd-input label {
display: block;
}
input.grd-privkey {
width: 465px;
}
input.grd-pubkey {
width: 465px;
}
input.grd-non-der-keys {
width: 900px;
}
input:not([type='radio']) {
width: 200px;
}
label:not(.grd_radio_label) {
width: 80px;
display: inline-block;
}
*/

View File

@ -80,8 +80,10 @@
.header-notify {
grid-area: header;
}
}
.center-form-single,
.content {
grid-area: center;
grid-row-start: line2;
@ -99,3 +101,4 @@
grid-row-start: footer2;
grid-row-end: end;
}

View File

@ -32,7 +32,9 @@
@content-nav: #565656;
/* CONTENT-ITEMS */
@action-button-text: #fff;
@action-button-border: #047006;
@action-button-background1: #047006;
@action-button-background: #f9fafb;
@info-item-border: grey;
@form-header-border: #047006;

View File

@ -157,6 +157,13 @@
color: @unobtrusive;
}
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled),
button:not(:disabled) {
cursor: pointer
}
}
/* Ende @media screen */

View File

@ -1,6 +1,6 @@
/* ============================================================
Screen styles for center part.
Screen styles for the regular center part.
Datei : center.css
Datum : 2020-04-30

View File

@ -0,0 +1,151 @@
/* ============================================================
Screen styles for the simple center form. (login etc)
Datei : center-form-single.css
Datum : 2020-07-10
Autor : Christine Slotty
Copyright : Gradio
============================================================*/
@media screen {
.center-form-single {
width: 50%;
margin: auto;
}
.center-form-header {
margin-bottom: 50px;
}
.center-logo {
display: block;
margin: 0 auto;
width: 280px;
}
.center-logo img {
width: 100%;
vertical-align: middle;
border-style: none;
}
.center-form-container {
display: flex;
flex-direction: column;
padding: 2em 8em;
background-color: @container-background;
border-radius: 6px;
box-shadow: 0 0 10px 0 rgba(183, 192, 206, .2);
margin-bottom: 1.5rem;
border: 1px solid rgba(238, 238, 238, .75);
}
@media @tablet-down {
.center-form-header {
margin-bottom: 30px;
margin-top: -50px;
}
.center-form-single {
width: 97%;
margin: auto;
}
.center-form-container {
padding: 1em .5em;
}
}
.center-form-title {
}
.center-form-selectors {
display: flex;
justify-content: flex-end;
align-items: center;
height: 38px;
padding: 5px 0;
}
.center-form-form .form-control {
margin: auto;
}
.center-form-submit {
display: block;
width: 96%;
margin: auto;
}
.reset-pwd-link,
.signup-link {
padding: 0 20px;
& a {
color: @action-button-background1;
}
& p {
display: inline-block;
margin-block-start: 0;
margin-block-end: 0;
}
}
.center-bottom {
color: @unobtrusive;
text-align: center;
padding-top: 30px;
}
.flag-btn {
text-align: center;
vertical-align: middle;
padding: 3px 11px;
}
.flag {
display: block;
}
.flag-germany {
background: red;
border-top: 9px solid #000;
border-bottom: 9px solid #fc0;
width: 40px;
height: 10px;
}
.flag-england {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGlkPSJmbGFnLWljb24tY3NzLWdiIiB2aWV3Qm94PSIwIDAgNjQwIDQ4MCI+CiAgPHBhdGggZmlsbD0iIzAxMjE2OSIgZD0iTTAgMGg2NDB2NDgwSDB6Ii8+CiAgPHBhdGggZmlsbD0iI0ZGRiIgZD0iTTc1IDBsMjQ0IDE4MUw1NjIgMGg3OHY2Mkw0MDAgMjQxbDI0MCAxNzh2NjFoLTgwTDMyMCAzMDEgODEgNDgwSDB2LTYwbDIzOS0xNzhMMCA2NFYwaDc1eiIvPgogIDxwYXRoIGZpbGw9IiNDODEwMkUiIGQ9Ik00MjQgMjgxbDIxNiAxNTl2NDBMMzY5IDI4MWg1NXptLTE4NCAyMGw2IDM1TDU0IDQ4MEgwbDI0MC0xNzl6TTY0MCAwdjNMMzkxIDE5MWwyLTQ0TDU5MCAwaDUwek0wIDBsMjM5IDE3NmgtNjBMMCA0MlYweiIvPgogIDxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yNDEgMHY0ODBoMTYwVjBIMjQxek0wIDE2MHYxNjBoNjQwVjE2MEgweiIvPgogIDxwYXRoIGZpbGw9IiNDODEwMkUiIGQ9Ik0wIDE5M3Y5Nmg2NDB2LTk2SDB6TTI3MyAwdjQ4MGg5NlYwaC05NnoiLz4KPC9zdmc+Cg==);
background-size: cover;
width: 40px;
height: 28px;
}
.group {
padding-left: 10px;
padding-top: 10px;
padding-bottom: 10px;
}
.group-is-invalid {
background-color: rgba(240, 130, 95, .2);
border-color: #dc3545;
padding-right: calc(1.5em + .75rem);
background-image: url("data:image/svg+xml,%3csvg xmlns=!string!fill=!string!viewBox=!string!%3e%3cpath stroke=!string!d=!string!/%3e%3ccircle r=!string!/%3e%3ccircle cx=!string!r=!string!/%3e%3ccircle cy=!string!r=!string!/%3e%3ccircle cx=!string!cy=!string!r=!string!/%3e%3c/svg%3E");
background-repeat: no-repeat;
background-position: center right calc(.375em + .1875rem);
background-size: calc(.75em + .375rem) calc(.75em + .375rem)
}
.group-is-invalid .radio label .input-frame::before {
border-color: red;
}
}
/* Ende @media screen */

View File

@ -104,9 +104,9 @@ and open the template in the editor.
line-height: 1.5;
text-align: center;
vertical-align: middle;
color: #fff;
background-color: #047006;
border-color: #047006;
color: @action-button-text;
background-color: @action-button-background1;
border-color: @action-button-border;
border: 1px solid transparent;
border-radius: .2rem;
height: 35px;
@ -143,6 +143,7 @@ and open the template in the editor.
width: 450px;
}
.center-form-form .form-control,
.center-form .form-control {
width: 90%;
}
@ -165,81 +166,3 @@ and open the template in the editor.
}
}
/*
Button
.grd-form-bn:hover,
.grd-active {
background-color: @button-background-active;
border-color: @button-border-color;
}
.grd-form-bn {
padding: 5px;
border: 1px solid @form-button-border;
display: table-cell;
text-align: center;
vertical-align: middle;
color: @form-button-text;
}
.grd-form-bn-small {
}
a.grd-form-bn,
a.grd-form-bn:visited {
color: @button-text;
text-decoration: none;
}
.grd-form-bn-succeed {
background-color: @success-background;
color: @success;
margin-top: 3px;
margin-bottom: 3px;
}
.grd-form-bn-succeed:not([disabled]):hover {
background-color: @success-background-hover;
}
.grd-form-bn-discard {
margin-left: 5px;
border: 1px solid @error;
color: @error;
cursor: pointer;
}
form elements
.grd_textarea {
border: 1px solid grey;
background-color: @form-text-background;
padding: 5px;
font-style: italic;
}
.grd-input label {
display: block;
}
input.grd-privkey {
width: 465px;
}
input.grd-pubkey {
width: 465px;
}
input.grd-non-der-keys {
width: 900px;
}
input:not([type='radio']) {
width: 200px;
}
label:not(.grd_radio_label) {
width: 80px;
display: inline-block;
}
*/