diff -Naur -x CVS -x LocalSettings.php -x AdminSettings.php wikipedia.cvs20031121/includes/SpecialUserlogin.php wikipedia.cvs20031121.with-cookie-check/includes/SpecialUserlogin.php --- wikipedia.cvs20031121/includes/SpecialUserlogin.php 2003-11-15 13:26:37.000000000 +0000 +++ wikipedia.cvs20031121.with-cookie-check/includes/SpecialUserlogin.php 2003-11-21 18:40:13.000000000 +0000 @@ -77,6 +77,10 @@ global $wgUser, $wgOut, $wpPassword, $wpRetype, $wpName, $wpRemember; global $wpEmail, $wgDeferredUpdateList; + if (!cookieCheck()) { + return; + } + if (!$wgUser->isAllowedToCreateAccount()) { userNotPrivilegedMessage(); return; @@ -122,6 +126,10 @@ global $wgUser, $wpName, $wpPassword, $wpRemember; global $returnto; + if (!cookieCheck()) { + return; + } + if ( "" == $wpName ) { mainLoginForm( wfMsg( "noname" ) ); return; @@ -160,7 +168,7 @@ { global $wgUser, $wpName, $wgDeferredUpdateList, $wgOutputEncoding; global $wgCookiePath, $wgCookieDomain, $wgDBname; - + if ( "" == $wpName ) { mainLoginForm( wfMsg( "noname" ) ); return; @@ -357,4 +365,25 @@ } +/* private */ function cookieCheck() { + + global $HTTP_COOKIE_VARS, $wgOut, $returnto; + + # XXX: kind of crude check to see if cookies are enabled, but it works OK + + if ( "" == $HTTP_COOKIE_VARS[session_name()]) + { + # Don't go back to login page; they won't get time to + # enable cookies and send us one, so they'll get this msg again. Instead, + # let them enable cookies on the error page, then go back to login page. + # XXX: wipes returnto, unfortunately. + + $returnto = "Special:Userlogin"; + $wgOut->errorpage( "nocookies", "nocookiestext" ); + return false; + } + + return true; +} + ?> diff -Naur -x CVS -x LocalSettings.php -x AdminSettings.php wikipedia.cvs20031121/languages/Language.php wikipedia.cvs20031121.with-cookie-check/languages/Language.php --- wikipedia.cvs20031121/languages/Language.php 2003-11-20 13:40:30.000000000 +0000 +++ wikipedia.cvs20031121.with-cookie-check/languages/Language.php 2003-11-21 18:08:05.000000000 +0000 @@ -546,6 +546,8 @@ email address to them, and it also helps you if you forget your password.", "loginerror" => "Login error", +"nocookies" => "Cookies disabled", +"nocookiestext" => "Wikipedia uses cookies to log in users. You have cookies disabled. Please enable them and try again.", "noname" => "You have not specified a valid user name.", "loginsuccesstitle" => "Login successful", "loginsuccess" => "You are now logged in to Wikipedia as \"$1\".",