Exemple #1
0
 public function verifuserAction()
 {
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector->gotoRoute(array(), 'main-accueil');
     }
     // Get our form and validate it
     $form = $this->getLoginForm();
     if (!$form->isValid($request->getPost())) {
         // Invalid entries
         $this->view->form = $form;
         return $this->render('login');
         // re-render the login form
     }
     // Get our authentication adapter and check credentials
     $adapter = $this->getAuthAdapter($form->getValues());
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($adapter);
     if (!$result->isValid()) {
         // Invalid credentials
         $form->addError('Login ou Mot de Passe faux');
         $this->view->form = $form;
         return $this->render('login');
         // re-render the login form
     }
     $auth->getStorage()->write($adapter->getResultRowObject(null, 'MDP'));
     $oMapper = new Application_Model_Mapper_RefLogins();
     $nId = (int) (array) $adapter->getResultRowObject('ID');
     $oMapper->updateLogin($nId);
     $oMapperUser = new Application_Model_Mapper_Users();
     $oMapperUser->updateLastLogin($nId);
     // We're authenticated! Redirect to the home page
     $this->_helper->redirector->gotoRoute(array(), 'main-accueil');
 }
Exemple #2
0
 public function indexAction()
 {
     $this->view->message = "succes du login";
     $this->view->sousMessage = "Vous vous êtes loggés la dernière fois le : ";
     $oMapper = new Application_Model_Mapper_Users();
     $aIdentity = (array) Zend_Auth::getInstance()->getIdentity();
     $this->view->loginDate = $oMapper->getLastLoginDate($aIdentity['ID']);
 }