public function addSessionScripts()
{
$response = $this->pageStack->getPageResponse();
$session = array();
$session['userId'] = null;
$session['lang'] = 'en';
if ($this->pageStack->getSession() && $this->pageStack->getSession()->has('admin_language')) {
$session['lang'] = $this->pageStack->getSession()->get('admin_language');
}
$session['access'] = $this->acl->check(ACLRequest::create('jarves/entryPoint', ['path' => '/admin']));
if ($this->pageStack->isLoggedIn()) {
$user = $this->pageStack->getUser();
$session['userId'] = $user->getId();
$session['username'] = $user->getUsername();
$session['lastLogin'] = $user->getLastLogin();
$session['firstName'] = $user->getFirstName();
$session['lastName'] = $user->getLastName();
// $email = $user->getEmail();
// $session['emailMd5'] = $email ? md5(strtolower(trim($email))) : null;
$session['imagePath'] = $user->getImagePath();
}
$session['token'] = get_class($this->pageStack->getToken());
$css = 'window._session = ' . json_encode($session) . ';';
$response->addJs($css);
}