Source for file LoginController.php
Documentation is available at LoginController.php
* Copyright (C) 2009 Mai (Me Artificial Intelligence)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* @author Wouter Bulten (wouterbulten@mai-ai.org)
* @copyright Copyright (C) 2009 Mai (Me Artificial Intelligence)
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
* @link http://www.launchpad.net/mai
* @author Wouter Bulten (wouterbulten@mai-ai.org)
* @copyright Copyright (C) 2009 Mai (Me Artificial Intelligence)
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
* @link http://www.launchpad.net/mai
* Automatically removes every session for security reasons.
* Shows the login form and possible errors.
$params = $this->getRequest()->getParams();
$this->view->error = (!empty($params['error'])) ? $params['error'] : false;
* First step of the login process. Checks the OpenID identifier.
$identifier = $this->getRequest()->getParam('openid_identifier');
$this->_forward('index', null, null, array('error' => 'U heeft het formulier niet goed ingevuld.'));
//In development we want a fast login with the identifier 'test'
if(Zend_Registry::get('config')->application->development && $identifier === 'test')
$user->identifier = $identifier;
$user->save(Zend_Registry::get('conn_dbuser'));
$consumer = new Zend_OpenId_Consumer();
if(!$consumer->login($identifier, '/login/step2/'))
$this->_forward('index', null, null, array('error' => 'De door u opgegeven OpenID is niet geldig.'));
* Second and last step of the login system. Starts a session on success.
$consumer = new Zend_OpenId_Consumer();
if($consumer->verify($_GET, $identifier))
$user->identifier = $identifier;
$user->save(Zend_Registry::get('conn_dbuser'));
$this->_forward('index', null, null, array('error' => 'De door u opgegeven OpenID is niet geldig.'));
|