1
0
Fork 0

Fixed a bug in the log in process which led to redirecting to installation.

Dieser Commit ist enthalten in:
DSB 2012-10-27 13:39:33 +00:00
Ursprung 0fad2875f6
Commit 87f951530e
4 geänderte Dateien mit 31 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -204,8 +204,7 @@ class InstallController extends Msd_Controller_Action
$form->getElement('pass_confirm')->getValidator('Identical')->setToken($postData['pass']); $form->getElement('pass_confirm')->getValidator('Identical')->setToken($postData['pass']);
if ($form->isValid($postData)) { if ($form->isValid($postData)) {
$ini = new Msd_Ini(); $ini = new Msd_Ini();
$ini->set('name', $postData['user'], 'user'); $ini->set('user[\'' . $postData['user'] . '\']', md5($postData['pass']), 'users');
$ini->set('pass', md5($postData['pass']), 'user');
$ini->saveFile(APPLICATION_PATH . '/configs/users.ini'); $ini->saveFile(APPLICATION_PATH . '/configs/users.ini');
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step4'), null, true); $redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step4'), null, true);
$this->_response->setRedirect($redirectUrl); $this->_response->setRedirect($redirectUrl);

Datei anzeigen

@ -39,6 +39,16 @@ class Msd_Action_Helper_AssignConfigAndLanguage extends Zend_Controller_Action_H
$view = $this->getView(); $view = $this->getView();
$config = Msd_Registry::getConfig(); $config = Msd_Registry::getConfig();
if ($config->getParam('configFile', 'defaultConfig.ini') == 'defaultConfig.ini') { if ($config->getParam('configFile', 'defaultConfig.ini') == 'defaultConfig.ini') {
$configFiles = Msd_File::getConfigNames();
if (isset($configFiles[0])) {
// we do have saved configurations - load the first one
$config->load($configFiles[0]);
Msd_Registry::setConfig($config);
$dynamicConfig = Msd_Registry::getDynamicConfig();
$dynamicConfig->setParam('configFile', $configFiles[0]);
Msd_Registry::setDynamicConfig($dynamicConfig);
} else {
// nothing found -> redirect to installation
$redirectUrl = $view->serverUrl() . $view->url( $redirectUrl = $view->serverUrl() . $view->url(
array( array(
'controller' => 'install', 'controller' => 'install',
@ -49,6 +59,7 @@ class Msd_Action_Helper_AssignConfigAndLanguage extends Zend_Controller_Action_H
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl($redirectUrl); $redirector->gotoUrl($redirectUrl);
} }
}
$view->config = $config; $view->config = $config;
$view->dynamicConfig = Msd_Registry::getDynamicConfig(); $view->dynamicConfig = Msd_Registry::getDynamicConfig();
$view->lang = Msd_Language::getInstance(); $view->lang = Msd_Language::getInstance();

Datei anzeigen

@ -65,7 +65,7 @@ class Msd_Auth_Adapter_Ini implements Zend_Auth_Adapter_Interface
*/ */
public function setUsername($username) public function setUsername($username)
{ {
$this->_username = (string) $username; $this->_username = (string)$username;
} }
/** /**
@ -77,7 +77,7 @@ class Msd_Auth_Adapter_Ini implements Zend_Auth_Adapter_Interface
*/ */
public function setPassword($password) public function setPassword($password)
{ {
$this->_password = (string) $password; $this->_password = (string)$password;
} }
/** /**
@ -96,14 +96,11 @@ class Msd_Auth_Adapter_Ini implements Zend_Auth_Adapter_Interface
} }
$authResult = false; $authResult = false;
foreach ($this->_users as $userId => $user) { foreach ($this->_users['users']['user'] as $name => $pass) {
if ( if ($this->_username == $name && md5($this->_password) == $pass) {
$this->_username == $user['name'] &&
md5($this->_password) == $user['pass']
) {
$authResult = array( $authResult = array(
'id' => $userId, 'id' => $name,
'name' => $user['name'], 'name' => $name,
); );
} }
} }

Datei anzeigen

@ -157,14 +157,10 @@ class Msd_User
} }
$usersConfig = new Msd_Ini($this->_usersFile); $usersConfig = new Msd_Ini($this->_usersFile);
$users = $usersConfig->get('user'); $users = $usersConfig->get('users');
$hasValidUser = false; $hasValidUser = false;
foreach ($users as $user) { if (!empty($users)) {
if (isset($user['name']) && isset($user['pass'])) {
$hasValidUser = true; $hasValidUser = true;
break;
}
} }
if (!$hasValidUser) { if (!$hasValidUser) {
return self::NO_VALID_USER; return self::NO_VALID_USER;