summaryrefslogblamecommitdiffstats
path: root/application/controllers/AuthController.php
blob: c0544377557561851ae36dc352367c323efa73e6 (plain) (tree)
1
2
3
4
5
6
7






                                                   




                                                      
                                                            

                                          




















                                                                         
  








                                            
<?php

class AuthController extends Zend_Controller_Action
{

    public function loginAction()
    {         
        $db = $this->_getParam('pbs_person');
 		if (!isset($_POST["login"])){
        $loginForm = new Application_Form_AuthLogin();
		} else {

        $loginForm = new Application_Form_AuthLogin($_POST);
 		
        if ($loginForm->isValid($_POST)) {
 
            $adapter = new Zend_Auth_Adapter_DbTable(
                $db,
                'users',
                'username',
                'password',
                'MD5(CONCAT(?, password_salt))'
                );
 
            $adapter->setIdentity($loginForm->getValue('email'));
            $adapter->setCredential($loginForm->getValue('password'));
 
            $result = $auth->authenticate($adapter);
 
            if ($result->isValid()) {
                $this->_helper->FlashMessenger('Erfolgreich angemeldet');
                $this->redirect('/');
                return;
            }
 
        }
 }
        $this->view->loginForm = $loginForm;
 
    }


}