{/if}
<div id="logo" class="logo">
- <a href="{link controller='Index'}{/link}">
+ <a href="{link}{/link}">
<h1>{lang}wcf.global.acp{/lang}</h1>
{if PACKAGE_ID > 1}
{event name='headerLogo'}
use wcf\system\WCF;
use wcf\util\HeaderUtil;
use wcf\util\PasswordUtil;
+use wcf\util\StringUtil;
/**
* Shows the master password form.
if (file_exists(WCF_DIR.'acp/masterPassword.inc.php')) {
require_once(WCF_DIR.'acp/masterPassword.inc.php');
}
+ else {
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink('MasterPasswordInit'));
+ exit;
+ }
}
/**
}
// check password
- if (PasswordUtil::secureCompare(PasswordUtil::getSaltedHash($this->masterPassword, MASTER_PASSWORD_SALT), MASTER_PASSWORD)) {
+ if (!PasswordUtil::secureCompare(MASTER_PASSWORD, PasswordUtil::getDoubleSaltedHash($this->masterPassword, MASTER_PASSWORD))) {
throw new UserInputException('masterPassword', 'invalid');
}
}
public function readData() {
parent::readData();
- if (empty($_POST)) {
+ if (empty($_POST) && StringUtil::indexOf(WCF::getSession()->requestURI, 'MasterPassword') === false) {
$this->url = WCF::getSession()->requestURI;
}
}
* @see wcf\page\IPage::readParameters()
*/
public function readParameters() {
- parent::readParameters();
+ AbstractForm::readParameters();
- if (defined('MASTER_PASSWORD') && defined('MASTER_PASSWORD_SALT')) {
- throw new IllegalLinkException();
+ if (file_exists(WCF_DIR.'acp/masterPassword.inc.php')) {
+ require_once(WCF_DIR.'acp/masterPassword.inc.php');
+
+ if (defined('MASTER_PASSWORD')) {
+ throw new IllegalLinkException();
+ }
}
}
* @see wcf\form\IForm::save()
*/
public function save() {
- // generate salt
- $salt = PasswordUtil::getRandomSalt();
-
// write master password file
$file = new File(WCF_DIR.'acp/masterPassword.inc.php');
$file->write("<?php
/** MASTER PASSWORD STORAGE
DO NOT EDIT THIS FILE */
-define('MASTER_PASSWORD', '".PasswordUtil::getSaltedHash($this->masterPassword, $salt)."');
-define('MASTER_PASSWORD_SALT', '".$salt."');
+define('MASTER_PASSWORD', '".PasswordUtil::getDoubleSaltedHash($this->masterPassword)."');
?>");
$file->close();
@chmod(WCF_DIR.'acp/masterPassword.inc.php', 0777);
if (file_exists(WCF_DIR.'acp/masterPassword.inc.php')) {
require_once(WCF_DIR.'acp/masterPassword.inc.php');
}
- if (defined('MASTER_PASSWORD') && defined('MASTER_PASSWORD_SALT')) {
+ if (defined('MASTER_PASSWORD')) {
$form = new MasterPasswordForm();
$form->__run();
exit;
// build route
if ($controller === null) {
- // build link to landing page
- $landingPage = PageMenu::getInstance()->getLandingPage();
- $controller = $landingPage->getController();
- $abbreviation = $landingPage->getApplication();
- $url = $landingPage->menuItemLink;
+ if ($isACP) {
+ $controller = 'Index';
+ }
+ else {
+ // build link to landing page
+ $landingPage = PageMenu::getInstance()->getLandingPage();
+ $controller = $landingPage->getController();
+ $abbreviation = $landingPage->getApplication();
+ $url = $landingPage->menuItemLink;
+ }
}
// handle object