fix session timeout, adding link, sorting lowercase

This commit is contained in:
Dario Rekowski on RockPI 2020-01-13 11:26:00 +00:00
parent 864ba53e4a
commit 217fed5c8a
3 changed files with 15 additions and 5 deletions

View File

@ -121,7 +121,11 @@ class AppController extends Controller
$GLOBALS["passed"] = $passedArguments[0];
}
$GLOBALS["subside"] = $subside;
// server login
if($this->Auth->user('id')) {
$GLOBALS['ServerUser'] = $this->Auth->user();
}
}
@ -157,7 +161,10 @@ class AppController extends Controller
if($json['state'] === 'success' && intval($json['user']['email_checked']) === 1) {
//echo "email checked: " . $json['user']['email_checked'] . "; <br>";
$session->destroy();
if($session->read('session_id') != $session_id ||
( $userStored && !isset($userStored['id']))) {
$session->destroy();
}
foreach($json['user'] as $key => $value) {
$session->write('StateUser.' . $key, $value );
}

View File

@ -238,7 +238,7 @@ class TransactionCreationsController extends AppController
//}
}
usort($possibleReceiver, function($a, $b) {
return ($a['name'] <=> $b['name']);
return (strtolower ($a['name']) <=> strtolower ($b['name']));
});
//var_dump($possibleReceiver);
$creationForm = new CreationForm();

View File

@ -1,4 +1,4 @@
<?php
<?php
use Cake\Routing\Router;
/**
@ -66,7 +66,10 @@ if(!isset($balance)) {
?>
</li>
<?php endif; ?>
<li><?= $this->Html->link(__('Startseite'), ['controller' => 'Dashboard'], ['class' => 'grd-nav-bn'])?>
<?php if(isset($GLOBALS['ServerUser'])) : ?>
<li><?= $this->Html->link(__('Server'), ['controller' => 'Dashboard', 'action' => 'serverIndex'], ['class' => 'grd-nav-bn'])?></li>
<?php endif; ?>
<li><?= $this->Html->link(__('Startseite'), ['controller' => 'Dashboard'], ['class' => 'grd-nav-bn'])?></li>
<!--<li><?= $this->Html->link(__('Kontostand'), ['controller' => 'StateBalances', 'action' => 'overview'], ['class' => 'grd-nav-bn']) ?>-->
<?php if(intval($transactionPendings) > 0) : ?>
<li>