public function loginAction()
 {
     $this->view->title = 'Login';
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->_redirect('index/index');
     }
     $request = $this->getRequest();
     $form = new Form_Login();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $authAdapter = $this->getAuthAdapter();
             $user = $form->getValue('username');
             $password = $form->getValue('password');
             $authAdapter->setIdentity($user)->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $identity = $authAdapter->getResultRowObject();
                 $authStorage = $auth->getStorage();
                 $authStorage->write($identity);
                 $this->_redirect('index/index');
             } else {
                 echo $this->view->errorMessage = "Username and password does not match";
             }
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 2
0
 public function loginAction()
 {
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->_redirect('index/index');
     }
     $form = new Form_Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $authAdapter = $this->getAdapter();
             $username = $form->getValue('username');
             $password = $form->getValue('password');
             $authAdapter->setIdentity($username)->setCredential($password);
             echo 'start';
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             echo 'end';
             if ($result->isValid()) {
                 $identity = $authAdapter->getResultRowObject();
                 $authStorage = $auth->getStorage();
                 $authStorage->write($identity);
                 echo 'ok';
                 //$this->_redirect('index/index');
             } else {
                 echo 'no';
                 $this->view->errorMessage = '<ul class="error"><li>Username or password is wrong!</li></ul>';
             }
         }
     }
     $form->setAction('../authentication/login');
     $this->view->form = $form;
 }
 public function loginAction()
 {
     $loginForm = new Form_Login();
     $resetForm = new Form_ResetPassword();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $loginForm->isValid($request->getPost());
         $adapter = new Infra_AuthAdapter($request->getPost('email'), $request->getPost('password'), $request->getPost('timezone_offset'));
         //$adapter = new Zend_Auth_Adapter_DbTable($zendDb);
         $auth = Infra_AuthHelper::getAuthInstance();
         $result = $auth->authenticate($adapter);
         if ($result->isValid()) {
             // Zend_Session::getSaveHandler()->write(uniqid(), $result->getIdentity());
             if ($request->getPost('remember_me')) {
                 Zend_Session::rememberMe(60 * 60 * 24 * 7);
             }
             // 1 week
             $nextUri = $this->_getParam('next_uri');
             KalturaLog::debug("next uri {$nextUri}");
             if ($nextUri && strlen($nextUri) > 1) {
                 $this->_helper->redirector->gotoUrl($nextUri);
             } else {
                 $this->_helper->redirector('list-by-user', 'partner');
             }
         } else {
             $loginForm->setDescription('invalid login');
         }
     }
     $loginForm->setDefault('next_uri', $this->_getParam('next_uri'));
     // set in Infra_AuthPlugin
     $this->view->loginForm = $loginForm;
     $this->view->resetForm = $resetForm;
     $this->render('login');
 }
 public function logowanieAction()
 {
     $this->view->title = 'Logowanie';
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->_redirect('/');
     }
     $request = $this->getRequest();
     $form = new Form_Login();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $authAdapter = $this->getAuthAdapter();
             $username = $form->getValue('username');
             $password = $form->getValue('password');
             $authAdapter->setIdentity($username)->setCredential($password)->setCredentialTreatment('MD5(?)');
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $identity = $authAdapter->getResultRowObject();
                 $authStorage = $auth->getStorage();
                 $authStorage->write($identity);
                 $server = new Zend_View_Helper_ServerUrl();
                 $server->setScheme('http');
                 $this->_redirect($server->serverUrl($this->view->url(array('controller' => 'zdjecia', 'action' => 'index'))));
                 //                    $this->_redirect('/zdjecia/');
             } else {
                 $this->view->errorMessage = 'Nieprawidłowa nazwa użytkownika lub hasło.';
             }
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 5
0
 public function loginAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageHeading = "Login";
     $this->_helper->layout->setLayout('login');
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $chkLogin = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_username='******'admin_username']) . "' and admin_password='******'admin_password'])) . "'");
             if ($chkLogin != "" and count($chkLogin) > 0) {
                 $mySession->adminId = $chkLogin[0]['admin_id'];
                 $this->_redirect('dashboard');
             } else {
                 $mySession->errorMsg = "Invalid username or password.";
                 $this->view->myform = $myform;
                 $this->render('index');
             }
         } else {
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         $this->_redirect('index');
     }
 }
Ejemplo n.º 6
0
 public function loginAction()
 {
     /*
      * Creating $loginForm object of class Form_Login
      */
     $loginForm = new Form_Login();
     /*
      * Trying to redirect to the page from which it came
      */
     $redirect = $this->getRequest()->getParam('redirect', 'index/index');
     $loginForm->setAttrib('redirect', $redirect);
     /*
      * Get the Zend_Auth instance
      */
     $auth = Zend_Auth::getInstance();
     /*
      * Check whether it has any identity , else check whether the login form is submitted
      */
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->_redirect('/index/hello');
     } else {
         if ($this->getRequest()->isPost()) {
             if ($loginForm->isValid($this->getRequest()->getPost())) {
                 /*
                  * Get the username
                  */
                 $username = $this->getRequest()->getPost('username');
                 /*
                  * Get password
                  */
                 $pwd = $this->getRequest()->getPost('pass');
                 /*
                  * Create object $authAdapter of class Model_AuthAdapter
                  */
                 $authAdapter = new Model_AuthAdapter($username, $pwd);
                 /*
                  * Try to authenticate and check whether its valid
                  */
                 $result = $auth->authenticate($authAdapter);
                 if (!$result->isValid()) {
                     switch ($result->getCode()) {
                         case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
                             $this->view->error = 'user credentials not found';
                     }
                 } else {
                     /*
                      * If its valid redirect it . Now it will not work ;) . 
                      * Have not implemented the redirect to the page from where it came.
                      */
                     $this->_redirect($redirect);
                 }
             }
         }
     }
     /*
      * Assign the form elements to view
      */
     $this->view->loginForm = $loginForm;
 }
Ejemplo n.º 7
0
 public function indexAction()
 {
     $form = new Form_Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             if ($this->_process($form->getValues())) {
                 // We're authenticated! Redirect to the home page
                 $this->_helper->redirector('index', 'index');
             }
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 8
0
 public function loginAction()
 {
     $formLogin = new Form_Login();
     if ($this->_request->isPost()) {
         if ($formLogin->isValid($this->_request->getParams())) {
             $user = new Model_User();
             if ($user->authorize($formLogin->getValue('email'), $formLogin->getValue('password'))) {
                 $this->_helper->redirector('index');
             } else {
                 $this->view->error = 'Неверные данные авторизации';
             }
         }
     }
     $this->view->form = $formLogin;
 }
Ejemplo n.º 9
0
 public function indexAction()
 {
     $this->view->title = "Página de Login do Projeto Piloto";
     $this->_helper->layout->setLayout('login');
     $form = new Form_Login();
     $data = $this->_getAllParams();
     $this->view->form = $form;
     if ($this->_getParam('sessao') == 'expirada') {
         $this->view->message_sessao = "Sua sessão expirou, favor logar novamente";
     }
     try {
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 $userNs = new Zend_Session_Namespace('userNs');
                 $authAdapter = new App_Auth_Adapter_Db();
                 $authAdapter->setIdentity($form->getValue('COU_COD_MATRICULA'));
                 $authAdapter->setCredential($form->getValue('COU_COD_PASSWORD'));
                 $authAdapter->setDbName($form->getValue('COU_NM_BANCO'));
                 $uf = strtoupper(substr($form->getValue('COU_COD_MATRICULA'), 0, 2));
                 $auth = Zend_Auth::getInstance();
                 $result = $auth->authenticate($authAdapter);
                 $messageLogin = $result->getMessages();
                 if ($result->isValid()) {
                     $data = $authAdapter->getResultRowObject(null, 'COU_COD_PASSWORD');
                     $userNs->matricula = strtoupper($form->getValue('COU_COD_MATRICULA'));
                     $userNs->banco = $messageLogin[1];
                     $userNs->codSec = $messageLogin[2];
                     $userNs->perfil = 'usuario';
                     $userNs->uf = $uf;
                     $userNs->nome = 'Marcelo Caixeta Rocha';
                     $userNs->siglasecao = 'TR';
                     $userNs->codlotacao = 1133;
                     $userNs->siglalotacao = 'DISAD';
                     $userNs->descicaolotacao = 'DIVISÃO DE SISTEMAS ADMINISTRATIVOS';
                     $userNs->localizacao = '';
                     $userNs->email = strtolower($form->getValue('COU_COD_MATRICULA')) . '@trf1.jus.br';
                     return $this->_helper->_redirector('index', 'fase-administrativa', 'sisad');
                 } else {
                     $this->view->message = $messageLogin[0];
                 }
             }
         }
     } catch (Exception $e) {
         $e = 'Logon Negado';
         $this->view->message = $e;
     }
 }
 public function loginAction()
 {
     $this->view->title = "User Login.";
     $this->view->headTitle($this->view->title, 'PREPEND');
     $form = new Form_Login();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $user = new Model_User();
             if ($user->authorize($form->getValue('vUsername'), $form->getValue('vPassword'))) {
                 $this->_redirect('/index/');
             } else {
                 $this->view->error = "Wrong E-mail or Password.";
             }
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 11
0
 public function indexAction()
 {
     $form = new Form_Login('/login/index/');
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $authAdapter = $form->username->getValidator('Authorise')->getAuthAdapter();
             $data = $authAdapter->getResultRowObject(null, 'password');
             $auth = Zend_Auth::getInstance();
             $auth->getStorage()->write($data);
             $this->_redirect('index/');
         } else {
             $auth = Zend_Auth::getInstance();
             $auth->clearIdentity();
             $form->populate($this->_request->getPost());
         }
     }
     $this->view->form = $form;
 }
 public function loginAction()
 {
     $form = new Form_Login();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             if ($this->loginCheck($form->getValue('login'), $form->getValue('senha'))) {
                 return $this->_helper->redirector('index', 'index', 'default');
             } else {
                 $this->_helper->FlashMessenger(implode(' ', $this->result->getMessages()));
                 return $this->forward('index');
             }
         } else {
             $form->populate($formData);
             return $this->forward('index');
         }
     }
 }
 public function indexAction()
 {
     $form = new Form_Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             if ($this->_process($form->getValues())) {
                 $role = Zend_Auth::getInstance()->getStorage()->read()->getRole();
                 // We're authenticated! Redirect to the home page depending on role
                 if ($role === 'admin') {
                     $this->_helper->redirector('index', 'federico');
                 } else {
                     $this->_helper->redirector('index', 'users');
                 }
             }
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 14
0
 public function loginAction()
 {
     $request = $this->getRequest();
     $form = new Form_Login();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $authAdapter = new Netons_AuthAdapter();
         $authAdapter->setIdentity($form->getValue('identity'));
         $authAdapter->setCredential($form->getValue('password'));
         $auth = Zend_Auth::getInstance();
         $result = $auth->authenticate($authAdapter);
         if ($result->isValid()) {
             $data = $authAdapter->getResultRowObject(null, 'password');
             $auth->getStorage()->write($data);
             $this->_redirector->gotoSimple('index', 'index');
         } else {
             $this->view->errors = array('Wrong username or password.');
         }
     }
     $this->view->headTitle('Login');
     $this->view->form = $form;
 }
Ejemplo n.º 15
0
 public function loginAction()
 {
     global $mySession;
     $db = new Db();
     $this->_helper->layout()->setLayout('simplecontent');
     $myformsignup = new Form_Signupdesigned();
     $this->view->myformsignup = $myformsignup;
     if ($this->getRequest()->isPost()) {
         //$abc=$this->getRequest()->getParam('abc');
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $qury = $db->runquery("Select * from " . USERS . " where emailid='" . $dataForm['emailid'] . "' AND password='******'pass'] . "'");
             if ($qury != "" and count($qury) > 0) {
                 if ($qury[0]['user_status'] == 1) {
                     $mySession->TeeLoggedID = $qury[0]['user_id'];
                     //$this->_redirect('launchcampaign/index');
                     echo "<script>parent.top.location='" . APPLICATION_URL . "launchcampaign/index';</script>";
                     exit;
                 } else {
                     $mySession->errorMsg = "Your Account is inactivated by admin";
                     $this->_redirect('logindesigned/index');
                 }
             } else {
                 $mySession->errorMsg = "invalid Email Address & Password";
                 $this->_redirect('logindesigned/index');
             }
         } else {
             //$mySession->errorMsg="form not valid";
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         //$mySession->errorMsg="check out";
         $this->_redirect('logindesigned/index');
     }
 }
Ejemplo n.º 16
0
 public function indexAction()
 {
     // Rate limit the login form by IP address, with a maximum of 10 requests every 5 minutes
     $rateLimit = new Noginn_RateLimit(array('login', $_SERVER['REMOTE_ADDR']), 10, 5);
     $form = new Form_Login();
     if ($rateLimit->exceeded()) {
         // A CAPTCHA is added to the form is the rate limit is exceeded
         $form->addCaptcha();
     }
     if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
         // Validate the login
         $values = $form->getValues();
         if ($values['username'] == $this->_username && $values['password'] == $this->_password) {
             // Correct login, continue
             $this->_helper->redirector('account');
         } else {
             // Increment request count for failed login attempts
             $rateLimit->increment();
         }
     }
     $form->setAction($this->_helper->url->url());
     $this->view->form = $form;
     $this->view->rateLimit = $rateLimit;
 }
Ejemplo n.º 17
0
 public function indexAction()
 {
     /* $event_manager = new App_EventTrigger();
               $event_manager->events()->attach('bar', function ($e) {
               $event = $e->getName();
               $target = get_class($e->getTarget());
               $params = json_encode($e->getParams());
     
               sprintf(
               '%s called on %s, using params %s', $event, $target, $params
               );
               });
     
               // Results in log message:
               $event_manager->bar('baz', 'bat'); */
     $this->_helper->layout->setLayout('front-home');
     $referrer = $this->_getParam('referrer', '');
     $form = new Form_Login();
     $error = false;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             try {
                 if (!$this->_identity->login($form->login_id->getValue(), base64_encode($form->password->getValue()))) {
                     $error = true;
                     throw new Exception();
                 }
                 $role = $this->_identity->getRoleId();
                 if ($role == 1 || $role == 2 || $role == 22) {
                     parent::_redirect('/iadmin/');
                 }
                 if (in_array($role, array(14, 15))) {
                     parent::_redirect('/campaign/manage-campaigns/');
                 }
                 if (in_array($role, array(25))) {
                     parent::_redirect('/dashboard/?office=1');
                 }
                 if (in_array($role, array(30))) {
                     parent::_redirect('/dashboard/?office=2');
                 }
                 if (in_array($role, array(26))) {
                     parent::_redirect('/dashboard/?office=6');
                 }
                 if (in_array($role, array(27, 31))) {
                     parent::_redirect('/dashboard/?office=6');
                 }
                 if (in_array($role, array(3, 4, 5, 6, 17, 24))) {
                     parent::_redirect("/reports/dashlet/cold-chain-capacity");
                 }
                 //$this->_populateSession();
                 if (isset($referrer) && !empty($referrer)) {
                     parent::_redirect(base64_decode($referrer));
                 } else {
                     parent::_redirect('/dashboard/index');
                 }
             } catch (Exception $e) {
                 App_FileLogger::info($e);
                 $form->populate($formData);
                 $error = "Username Or Password is incorrect!";
             }
         } else {
             $form->populate($formData);
         }
     }
     $this->view->headTitle('Log In');
     $this->view->form = $form;
     $this->view->error = $error;
 }
Ejemplo n.º 18
0
 public function loginAction()
 {
     $form = new Form_Login();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $user = new Model_User();
             //authorize() - фу-я описана в моделі,
             //повертає true, якщо авторизація пройшла успішно
             if ($user->authorize($form->getValue('username'), $form->getValue('password'))) {
                 $this->_helper->redirector('login');
             } else {
                 $this->view->error = "Невірні дані авторизації";
             }
         }
     }
     $this->view->form = $form;
 }
Ejemplo n.º 19
0
 public function loginedAction()
 {
     global $mySession;
     $db = new Db();
     $this->_helper->layout->setLayout('myaccount');
     $launch = $this->getRequest()->getParam('l');
     $this->view->l = $launch;
     //echo "from launch : ".$launch; die;
     $myformsignup = new Form_Signup();
     $this->view->myformsignup = $myformsignup;
     if ($this->getRequest()->isPost()) {
         //$abc=$this->getRequest()->getParam('abc');
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $qury = $db->runquery("Select * from " . USERS . " where emailid='" . $dataForm['emailid'] . "' AND password='******'pass']) . "'");
             //echo "Select * from ".USERS." where emailid='".$dataForm['emailid']."' AND password='******'pass']."'"; die;
             if ($qury != "" and count($qury) > 0) {
                 if ($qury[0]['user_status'] == 1) {
                     if ($qury[0]['active_status'] == 1) {
                         if ($mySession->camptitl != "" && $mySession->showurl != "") {
                             //$mySession->errorMsg ="Login First to launch your campaign";
                             //echo "from launch"; die;
                             $mySession->TeeLoggedID = $qury[0]['user_id'];
                             $this->_redirect('launchcampaign/adddescription/login/login');
                         } elseif ($mySession->save_login_url != '') {
                             //echo "normal login"; die;
                             $mySession->TeeLoggedID = $qury[0]['user_id'];
                             $this->_redirect($mySession->save_login_url);
                         } else {
                             //echo "normal login"; die;
                             $mySession->TeeLoggedID = $qury[0]['user_id'];
                             $this->_redirect('myaccount/profile');
                         }
                     } else {
                         $mySession->errorMsg = "Activate your account by clicking on the link sent to your mail";
                         $this->_redirect('login/index');
                     }
                 } else {
                     $mySession->errorMsg = "Your Account is inactivated by admin";
                     $this->_redirect('login/index');
                 }
             } else {
                 $mySession->errorMsg = "Invalid Email Address & Password";
                 $this->_redirect('login/index');
             }
         } else {
             //$mySession->errorMsg="form not valid";
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         //$mySession->errorMsg="check out";
         $this->_redirect('login/index');
     }
 }
Ejemplo n.º 20
0
 public function loginAction()
 {
     $form = new Form_Login();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $user = new Model_User();
             if ($user->authorize($form->getValue('username'), $form->getValue('password'))) {
                 $this->_helper->redirector('login');
             } else {
                 $this->view->error = 'Неверные данные авторизации.';
             }
         }
     }
     $this->view->form = $form;
 }
 public function loginAction()
 {
     $loginForm = new Form_Login();
     $resetForm = new Form_ResetPassword();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $loginForm->isValid($request->getPost());
         $adapter = new Infra_AuthAdapter($request->getPost('email'), $request->getPost('password'), $request->getPost('timezone_offset'));
         $auth = Infra_AuthHelper::getAuthInstance();
         $storage = new Zend_Auth_Storage_Session("Zend_Auth_AdminConsole");
         $auth->setStorage($storage);
         $result = $auth->authenticate($adapter);
         if ($result->isValid()) {
             if ($request->getPost('remember_me')) {
                 Zend_Session::rememberMe(60 * 60 * 24 * 7);
             }
             // 1 week
             $nextUri = $this->_getParam('next_uri');
             if ($nextUri) {
                 $this->_helper->redirector->gotoUrl($nextUri);
             } else {
                 $this->_helper->redirector('list', 'partner');
             }
         } else {
             $loginForm->setDescription('login error');
         }
     }
     $loginForm->setDefault('next_uri', $this->_getParam('next_uri'));
     // set in Infra_AuthPlugin
     $this->view->loginForm = $loginForm;
     $this->view->resetForm = $resetForm;
     $this->render('login');
 }
Ejemplo n.º 22
0
 public function loginAction()
 {
     $loginForm = new Form_Login();
     $resetForm = new Form_ResetPassword();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $loginForm->isValid($request->getPost());
         $adapter = new Kaltura_AdminAuthAdapter();
         $adapter->setPrivileges('disableentitlement');
         $safeEmailFieldValue = strip_Tags($request->getPost('email'));
         // Strip HTML Tags to prevent a potential XSS attack
         $passwordFieldValue = $request->getPost('password');
         // DO NOT strip 'password' HTML Tags in order not to invalidate passwords (e.g. "<b>BoldPassword</b>")
         $adapter->setCredentials($safeEmailFieldValue, $passwordFieldValue);
         $loginForm->getElement('email')->setValue($safeEmailFieldValue);
         // Update the "safe" value onto the form
         $adapter->setTimezoneOffset($request->getPost('timezone_offset'));
         $auth = Infra_AuthHelper::getAuthInstance();
         $result = $auth->authenticate($adapter);
         if ($result->isValid()) {
             if ($request->getPost('remember_me')) {
                 Zend_Session::rememberMe(60 * 60 * 24 * 7);
             }
             // 1 week
             $nextUri = $this->_getParam('next_uri');
             if ($nextUri) {
                 $this->_helper->redirector->gotoUrl($nextUri);
             } else {
                 $this->_helper->redirector('list', 'partner');
             }
         } else {
             $loginForm->setDescription('login error');
         }
     }
     $loginForm->setDefault('next_uri', $this->_getParam('next_uri'));
     // set in Infra_AuthPlugin
     $this->view->loginForm = $loginForm;
     $this->view->resetForm = $resetForm;
     $this->render('login');
 }
 /**
  * Rotina de login
  */
 public function loginAction()
 {
     $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $this->view->messages = $this->_flashMessenger->getMessages();
     $form = new Form_Login();
     $this->view->form = $form;
     /*
      * Verifica se existem dados de POST
      */
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         /*
          * Formulário corretamente preenchido?
          */
         if ($form->isValid($data)) {
             $login = $form->getValue('login');
             $senha = $form->getValue('senha');
             $dbAdapter = Zend_Db_Table::getDefaultAdapter();
             /*
              * Inicia o adaptador Zend_Auth para banco de dados
              */
             $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
             $authAdapter->setTableName('usuarios')->setIdentityColumn('login')->setCredentialColumn('senha')->setCredentialTreatment('SHA1(?)');
             /*
              * Define os dados para processar o login
              */
             $authAdapter->setIdentity($login)->setCredential($senha);
             /*
              * Efetua o login
              */
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             /*
              * Verifica se o login foi efetuado com sucesso
              */
             if ($result->isValid()) {
                 /*
                  * Armazena os dados do usuário em sessão, apenas desconsiderando                     
                  * a senha do usuário
                  */
                 $info = $authAdapter->getResultRowObject(null, 'senha');
                 $storage = $auth->getStorage();
                 $storage->write($info);
                 /*
                  * Redireciona para o Controller protegido
                  */
                 return $this->_helper->redirector->goToRoute(array('controller' => 'index'), null, true);
             } else {
                 /*
                  * Dados inválidos
                  */
                 $this->_helper->FlashMessenger('Usu&aacute;rio ou senha inv&aacute;lidos!');
                 $this->_redirect('/auth/login');
             }
         } else {
             /*
              * Formulário preenchido de forma incorreta
              */
             $form->populate($data);
         }
     }
 }