summaryrefslogtreecommitdiffstats
path: root/application/controllers/AuthController.php
blob: 32d2eb30a40f5232093da63b12262d9fc312c02e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

class AuthController extends Zend_Controller_Action
{

    public function loginAction()
    {         
        $db = $this->_getParam('db');
 
        $loginForm = new Application_Form_AuthLogin($_POST);
 
        if ($loginForm->isValid($loginForm)) {
 
            $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;
 
    }


}