From 04b7d7b02fb2ac33adf1a47d93e99da7dfea3f2b Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Sat, 28 May 2005 10:14:37 +0000 Subject: [PATCH] Detect if cookies are enabled at login-time. If not, print a message explaining what is wrong. --- presentation/login.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/presentation/login.php b/presentation/login.php index 030ec06..5976ce7 100644 --- a/presentation/login.php +++ b/presentation/login.php @@ -37,6 +37,8 @@ $errorMessage = $_REQUEST['errorMessage']; if ($_REQUEST['loginAction'] == "loginForm") { // TODO: build login form using PatternMainPage + $cookietest = KTUtil::randomString(); + setcookie("CookieTestCookie", $cookietest, false); print " uiUrl/stylesheet.php\"> @@ -82,6 +84,7 @@ if ($_REQUEST['loginAction'] == "loginForm") { \n + \n \n " . _("System Version") . ": " . $default->systemVersion . " @@ -93,6 +96,12 @@ if ($_REQUEST['loginAction'] == "loginForm") { // set default url for login failure // with redirect appended if set $url = $url . "login.php?loginAction=loginForm" . (isset($redirect) ? "&redirect=" . urlencode($redirect) : ""); + $cookieTest = KTUtil::arrayGet($_COOKIE, "CookieTestCookie", null); + if (is_null($cookieTest) || $cookieTest != KTUtil::arrayGet($_REQUEST, "cookietestinput")) { + $url .= "&errorMessage=" . urlencode(_("KnowledgeTree requires cookies to work")); + redirect($url); + exit(0); + } // if requirements are met and we have a username and password to authenticate if (isset($_REQUEST['fUserName']) && isset($_REQUEST['fPassword']) ) { @@ -164,6 +173,7 @@ if ($_REQUEST['loginAction'] == "loginForm") { redirect($url); } else { // redirect to root - redirect($default->rootUrl); + $url = generateLink("", ""); + redirect($url); } ?> -- libgit2 0.21.4