]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #4698 - Login block is broken!, improved cookie test; merged from MOODLE_16_STABLE
authorskodak <skodak>
Thu, 6 Jul 2006 10:11:06 +0000 (10:11 +0000)
committerskodak <skodak>
Thu, 6 Jul 2006 10:11:06 +0000 (10:11 +0000)
login/index.php
login/index_form.html

index 618b4b7a8e857123dc361c304ee7d051d53122b3..4fa8f400f31e67d87ea35bb804497f32e06e998b 100644 (file)
@@ -2,7 +2,8 @@
 
     require_once("../config.php");
 
-    $loginguest = optional_param('loginguest', 0, PARAM_BOOL); // determines whether visitors are logged in as guest automatically
+    $loginguest  = optional_param('loginguest', 0, PARAM_BOOL); // determines whether visitors are logged in as guest automatically
+    $testcookies = optional_param('testcookies', 0, PARAM_BOOL); // request cookie test
 
     //initialize variables
     $errormsg = '';
@@ -95,7 +96,7 @@
 
 /// Check if the user has actually submitted login data to us
 
-    if (empty($CFG->usesid) and $frm and (get_moodle_cookie() == '') and ($frm->username!='guest') and !$user and empty($CFG->alternateloginurl)) {    // Login without cookie
+    if (empty($CFG->usesid) and $testcookies and (get_moodle_cookie() == '')) {    // Login without cookie when test requested
 
         $errormsg = get_string("cookiesnotenabled");
 
index d68bdb29b14266ecc62be1effe3db407ccb223fd..e98d639d2ce05e02b73f843e0575a69bdc830da6 100644 (file)
@@ -47,6 +47,7 @@
           </td>
           <td width="20%">
             <input type="submit" value="<?php print_string("login") ?>" />
+            <input type="hidden" name="testcookies" value="1" />
           </td>
         </tr>
         </table>
@@ -58,6 +59,7 @@
         <form action="index.php" method="post" name="guestlogin">
           <input type="hidden" name="username" value="guest" />
           <input type="hidden" name="password" value="guest" />
+          <input type="hidden" name="testcookies" value="1" />
           <input type="submit" value="<?php print_string("loginguest") ?>" />
         </form>
 <?php } ?>