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']);
if ($form->isValid($postData)) {
$ini = new Msd_Ini();
$ini->set('name', $postData['user'], 'user');
$ini->set('pass', md5($postData['pass']), 'user');
$ini->set('user[\'' . $postData['user'] . '\']', md5($postData['pass']), 'users');
$ini->saveFile(APPLICATION_PATH . '/configs/users.ini');
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step4'), null, true);
$this->_response->setRedirect($redirectUrl);

Datei anzeigen

@ -39,15 +39,26 @@ class Msd_Action_Helper_AssignConfigAndLanguage extends Zend_Controller_Action_H
$view = $this->getView();
$config = Msd_Registry::getConfig();
if ($config->getParam('configFile', 'defaultConfig.ini') == 'defaultConfig.ini') {
$redirectUrl = $view->serverUrl() . $view->url(
array(
'controller' => 'install',
'action' => 'index',
null,
true)
);
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl($redirectUrl);
$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(
array(
'controller' => 'install',
'action' => 'index',
null,
true)
);
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl($redirectUrl);
}
}
$view->config = $config;
$view->dynamicConfig = Msd_Registry::getDynamicConfig();

Datei anzeigen

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

Datei anzeigen

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