public function __construct(PdoSessionHandler $saveHandler, array $validators = []) { $config = new StandardConfig(); $config->setOptions(['name' => 'mobicms', 'remember_me_seconds' => 1800, 'use_cookies' => true, 'cookie_httponly' => true]); $this->config = $config; $this->storage = new SessionArrayStorage(); $this->saveHandler = $saveHandler; $this->validators = $validators; }
public function autenticarAction() { // si no hay POST se redirecciona al login if (!$this->request->isPost()) { return $this->redirect()->toRoute('login', array('controller' => 'login')); } $form = new LoginForm(); $form->setInputFilter(new LoginFormValidator()); // Obtenemos los datos desde el Formulario con POST data: $data = $this->request->getPost(); $form->setData($data); // Validando el form if (!$form->isValid()) { $modelView = new ViewModel(array('form' => $form)); $modelView->setTemplate('application/login/index'); return $modelView; } $values = $form->getData(); $username = $values['username']; $password = $values['password']; $remember = $values['remember']; try { $this->login->setMessage('El nombre de Usuario y Contraseña no coinciden.', LoginService::NOT_IDENTITY); $this->login->setMessage('La contraseña ingresada es incorrecta. Inténtelo de nuevo.', LoginService::INVALID_CREDENTIAL); $this->login->setMessage('Los campos de Usuario y Contraseña no pueden dejarse en blanco.', LoginService::INVALID_LOGIN); $this->login->login($username, $password); if ($remember == 1) { $arrayConf = array('name' => 'CoreAppSesion', 'cookie_lifetime' => 2419200, 'remember_me_seconds' => 2419200, 'use_cookies' => true, 'cookie_httponly' => true); } else { $arrayConf = array('remember_me_seconds' => 1800, 'name' => 'CoreAppSesion'); } $config = new StandardConfig(); $config->setOptions($arrayConf); $manager = new SessionManager($config); //guardamos las variables de sesion $sesion = new Container('CoreAppSesion'); $sesion->user_username = $this->login->getIdentity()->usuarios_username; $sesion->user_user_id = $this->login->getIdentity()->usuarios_id; $sesion->user_rol_id = $this->login->getIdentity()->app_roles_id; $this->flashMessengerPlusControllerPlugin()->addSuccess('Login Correcto!', $this->login->message, false, null); //$this->logger->info("Login Correcto! Usuario: " . $username); $this->redirect()->toRoute('inicio'); } catch (\Exception $e) { $this->flashMessengerPlusControllerPlugin()->addError('Login Incorrecto!', $e->getMessage(), false, null); //$this->logger->err($e->getMessage()); return $this->redirect()->toRoute('login', array('controller' => 'login', 'action' => 'index')); } }
public function getSessionManager() { $config = new StandardConfig(); $config->setOptions(array('remember_me_seconds' => 1800, 'name' => 'tvp')); return new SessionManager($config); }
/** * @dataProvider optionsProvider */ public function testSetOptionsTranslatesUnderscoreSeparatedKeys($option, $getter, $value) { $options = array($option => $value); $this->config->setOptions($options); $this->assertSame($value, $this->config->$getter()); }
<?php define('REDBEAN_MODEL_PREFIX', '../Model_'); require __DIR__ . '/../vendor/autoload.php'; require 'rb.php'; /* require '../vendor/autoload.php'; $fvm = \RedBeanFVM\RedBeanFVM::getInstance(); gabordemooij\redbean\RedBeanPHP */ R::setup('mysql:host=localhost;dbname=smemailmf', 'root', ''); use Zend\Session\Config\StandardConfig; use Zend\Session\SessionManager; $config = new StandardConfig(); $config->setOptions(array('remember_me_seconds' => 1800000, 'name' => 'mailmf')); $manager = new SessionManager($config); //var_dump($manager); use Zend\Session\Storage\ArrayStorage; $populateStorage = array('foo' => 'bar'); $storage = new ArrayStorage($populateStorage); $manager = new SessionManager(); $manager->setStorage($storage); //var_dump($manager); /* $book = R::dispense("mail"); $book->author = "Santa Claus"; $book->title = "Secrets of Christmas"; $id = R::store( $book ); */