*}
<script>
- //<![CDATA[
- var SID_ARG_2ND = '{@SID_ARG_2ND_NOT_ENCODED}';
+ var SID_ARG_2ND = '';
var WCF_PATH = '{@$__wcf->getPath()}';
var SECURITY_TOKEN = '{@SECURITY_TOKEN}';
var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
var TIME_NOW = {@TIME_NOW};
var URL_LEGACY_MODE = {if URL_LEGACY_MODE}true{else}false{/if};
- //]]>
</script>
{if ENABLE_DEBUG_MODE}
{include file='userNotice'}
-{include file='formError'}
+{if !$errorField|empty && $errorField == 'cookie'}
+ <p class="error">{lang}wcf.user.login.error.cookieRequired{/lang}</p>
+{else}
+ {include file='formError'}
+{/if}
<div class="contentNavigation">
{hascontent}
<?php
namespace wcf\form;
+use wcf\system\exception\UserInputException;
use wcf\system\request\LinkHandler;
use wcf\system\user\authentication\UserAuthenticationFactory;
use wcf\system\WCF;
public $enableTracking = true;
/**
- * true enables the usage of cookies
+ * true enables the usage of cookies to save login credentials
* @var boolean
*/
public $useCookies = 1;
if (isset($_POST['useCookies'])) $this->useCookies = intval($_POST['useCookies']);
}
+ /**
+ * @see \wcf\form\IForm::validate()
+ */
+ public function validate() {
+ if (!WCF::getSession()->hasValidCookie()) {
+ throw new UserInputException('cookie');
+ }
+
+ parent::validate();
+ }
+
/**
* @see \wcf\form\IForm::save()
*/
use wcf\system\style\StyleHandler;
use wcf\system\template\TemplateEngine;
use wcf\system\user\storage\UserStorageHandler;
-use wcf\util\ArrayUtil;
use wcf\util\ClassUtil;
use wcf\util\FileUtil;
use wcf\util\StringUtil;
$factory->load();
self::$sessionObj = SessionHandler::getInstance();
+ self::$sessionObj->setHasValidCookie($factory->hasValidCookie());
}
/**
}
}
+ /**
+ * Returns true if session was based upon a valid cookie.
+ *
+ * @return boolean
+ */
+ public function hasValidCookie() {
+ return false;
+ }
+
/**
* Initializes the session system.
*/
*/
protected $sessionEditor = 'wcf\data\session\SessionEditor';
+ /**
+ * @see \wcf\system\session\ACPSessionFactory::hasValidCookie()
+ */
+ public function hasValidCookie() {
+ if (isset($_COOKIE[COOKIE_PREFIX.'cookieHash'])) {
+ if ($_COOKIE[COOKIE_PREFIX.'cookieHash'] == SessionHandler::getInstance()->sessionID) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* @see \wcf\system\session\ACPSessionFactory::readSessionID()
*/
protected function readSessionID() {
- $sessionID = parent::readSessionID();
-
// get sessionID from cookie
- if (empty($sessionID) && isset($_COOKIE[COOKIE_PREFIX.'cookieHash'])) {
- $sessionID = $_COOKIE[COOKIE_PREFIX . 'cookieHash'];
+ if (isset($_COOKIE[COOKIE_PREFIX.'cookieHash'])) {
+ return $_COOKIE[COOKIE_PREFIX . 'cookieHash'];
}
- return $sessionID;
+ return '';
}
/**
* @see \wcf\system\session\ACPSessionFactory::init()
*/
protected function init() {
- $usesCookies = true;
-
- if (isset($_COOKIE[COOKIE_PREFIX.'cookieHash'])) {
- if ($_COOKIE[COOKIE_PREFIX.'cookieHash'] != SessionHandler::getInstance()->sessionID) {
- $usesCookies = false;
- }
- }
- else {
- $usesCookies = false;
- }
-
- if (!$usesCookies) {
+ if (!$this->hasValidCookie()) {
// cookie support will be enabled upon next request
HeaderUtil::setCookie('cookieHash', SessionHandler::getInstance()->sessionID);
}
- else {
- // enable cookie support
- SessionHandler::getInstance()->enableCookies();
- }
+
+ // enable cookie support
+ SessionHandler::getInstance()->enableCookies();
parent::init();
}
*/
protected $groupData = null;
+ /**
+ * true if client provided a valid session cookie
+ * @var boolean
+ */
+ protected $hasValidCookie = false;
+
/**
* language id for active user
* @var integer
$this->usersOnlyPermissions = UserGroupOptionCacheBuilder::getInstance()->getData(array(), 'usersOnlyOptions');
}
+ /**
+ * Sets a boolean value to determine if the client provided a valid session cookie.
+ *
+ * @param boolean $hasValidCookie
+ */
+ public function setHasValidCookie($hasValidCookie) {
+ $this->hasValidCookie = $hasValidCookie;
+ }
+
+ /**
+ * Returns true if client provided a valid session cookie.
+ *
+ * @return boolean
+ */
+ public function hasValidCookie() {
+ return $this->hasValidCookie;
+ }
+
/**
* Loads an existing session or creates a new one.
*
<item name="wcf.user.userAgent"><![CDATA[Browser-Kennung]]></item>
<item name="wcf.user.login"><![CDATA[Anmeldung]]></item>
<item name="wcf.user.login.data"><![CDATA[Zugangsdaten]]></item>
+ <item name="wcf.user.login.error.cookieRequired"><![CDATA[Die Anmeldung erfordert den Einsatz von Cookies, bitte aktivieren Sie diese um die Anmeldung durchzufĂĽhren.]]></item>
<item name="wcf.user.password.error.false"><![CDATA[Dieses Kennwort ist falsch.]]></item>
<item name="wcf.user.language"><![CDATA[Sprache]]></item>
<item name="wcf.user.language.description"><![CDATA[Sprache der Benutzeroberfläche]]></item>
<item name="wcf.user.userAgent"><![CDATA[User Agent]]></item>
<item name="wcf.user.login"><![CDATA[Login]]></item>
<item name="wcf.user.login.data"><![CDATA[Credentials]]></item>
+ <item name="wcf.user.login.error.cookieRequired"><![CDATA[The login requires the acceptance of cookies, please enable cookies to proceed.]]></item>
<item name="wcf.user.password.error.false"><![CDATA[The entered password is wrong.]]></item>
<item name="wcf.user.language"><![CDATA[Language]]></item>
<item name="wcf.user.language.description"><![CDATA[User interface language]]></item>