Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:
      Both Safari and IE7. Former on Mac X 10.5.5 and other on PC running Windows XP. Hosted website running XP
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      35238

      Description

      I have just installed Moodle, established myself as the administrator and now cannot get into my site as I get 'Unfortunately cookes are currently not enabled in your browser'. I have been through the exising issues and note that this seems to be a common problem with no resolution so far. Can you please give me a workaround as I am simply blocked from doing anything more and cannot resolve the problem. Will probably have to ditch the whole project if I cannot find resolution. Please help.

        Activity

        Hide
        Jani Lemmetyinen added a comment -

        Find this with IE 6.5 as well. Safari and Firefox running OK.

        Show
        Jani Lemmetyinen added a comment - Find this with IE 6.5 as well. Safari and Firefox running OK.
        Hide
        William Jeffery Haslam added a comment -

        I managed to find a workaround which has solved the problem. I have been waiting to see if there has been any adverse side effects, but so far none. This means changing some of the code, but don't get worried as you can't do any damage.

        Firstly you have to look at the suite of files that are installed in your moodle directory. There should be an 'login' sub-directory. Open that. This subdirectory contains all the bits of code that handles the logging in of a user into the system, and it is where the problem lies. In that directory there should be a file named "index".

        You must open that file with a program that enables you to change the code.

        The file commences with the following code (to help you identify the correct file):

        <?php // $Id: index.php,v 1.129.2.3 2008/05/18 21:26:57 iarenaza Exp $

        require_once("../config.php");

        // check if major upgrade needed - also present in /index.php
        if ((int)$CFG->version < 2006101100)

        { //1.7 or older @require_logout(); redirect("$CFG->wwwroot/$CFG->admin/"); }

        OK?

        Now you have to track down to the following comment:

        ///Check if the user has actually submitted login data to us

        The next few lines should look like this:

        if (empty($CFG->usesid) and $testcookies and (get_moodle_cookie() == ''))

        { // Login without cookie when test requested $errormsg = get_string("cookiesnotenabled"); $errorcode = 1; } else if ($frm) {

        Now you have to 'comment out' the bit of evil code so as to make it harmless. This is done by placing a /* at the beginning of the offending code and a */ at the end. Once you have done that, this is what it should look like:

        /* if (empty($CFG->usesid) and $testcookies and (get_moodle_cookie() == '')) { // Login without cookie when test requested $errormsg = get_string("cookiesnotenabled"); $errorcode = 1; }

        else
        */
        If ($frm) {

        This simply removes the check to see whether the user has a 'cookie' that proves he/she has been there before. I can't really see why they have included that as it makes no difference and it is clear that some browsers don't keep the cookies in the way that this program anticipates them, hence the problem.

        Once you have made the changes and saved them, the program should work OK. Don't worry about making the changes, you can always go back and delete the /* and */ if the worst comes to the worst as this is all you would have added.

        Show
        William Jeffery Haslam added a comment - I managed to find a workaround which has solved the problem. I have been waiting to see if there has been any adverse side effects, but so far none. This means changing some of the code, but don't get worried as you can't do any damage. Firstly you have to look at the suite of files that are installed in your moodle directory. There should be an 'login' sub-directory. Open that. This subdirectory contains all the bits of code that handles the logging in of a user into the system, and it is where the problem lies. In that directory there should be a file named "index". You must open that file with a program that enables you to change the code. The file commences with the following code (to help you identify the correct file): <?php // $Id: index.php,v 1.129.2.3 2008/05/18 21:26:57 iarenaza Exp $ require_once("../config.php"); // check if major upgrade needed - also present in /index.php if ((int)$CFG->version < 2006101100) { //1.7 or older @require_logout(); redirect("$CFG->wwwroot/$CFG->admin/"); } OK? Now you have to track down to the following comment: ///Check if the user has actually submitted login data to us The next few lines should look like this: if (empty($CFG->usesid) and $testcookies and (get_moodle_cookie() == '')) { // Login without cookie when test requested $errormsg = get_string("cookiesnotenabled"); $errorcode = 1; } else if ($frm) { Now you have to 'comment out' the bit of evil code so as to make it harmless. This is done by placing a /* at the beginning of the offending code and a */ at the end. Once you have done that, this is what it should look like: /* if (empty($CFG->usesid) and $testcookies and (get_moodle_cookie() == '')) { // Login without cookie when test requested $errormsg = get_string("cookiesnotenabled"); $errorcode = 1; } else */ If ($frm) { This simply removes the check to see whether the user has a 'cookie' that proves he/she has been there before. I can't really see why they have included that as it makes no difference and it is clear that some browsers don't keep the cookies in the way that this program anticipates them, hence the problem. Once you have made the changes and saved them, the program should work OK. Don't worry about making the changes, you can always go back and delete the /* and */ if the worst comes to the worst as this is all you would have added.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Assigning this to Petr. He knows far more about sesisons and so than me. My tests under IE tell are working ok here, but I cannot imagine a primary cause for this.

        Show
        Eloy Lafuente (stronk7) added a comment - Assigning this to Petr. He knows far more about sesisons and so than me. My tests under IE tell are working ok here, but I cannot imagine a primary cause for this.
        Hide
        Petr Škoda added a comment -

        This code will be rewritten in 2.0, I am not going to touch it in 1.9x any more. This test does work for very many ppl and really helps to detect disabled cookies in browsers.

        btw if you do not want this test it might be easier to change 1-->0
        <input type="hidden" name="testcookies" value="1" />
        in login/index_form.php

        Show
        Petr Škoda added a comment - This code will be rewritten in 2.0, I am not going to touch it in 1.9x any more. This test does work for very many ppl and really helps to detect disabled cookies in browsers. btw if you do not want this test it might be easier to change 1-->0 <input type="hidden" name="testcookies" value="1" /> in login/index_form.php
        Hide
        Luis de Vasconcelos added a comment -

        http://moodle.org/mod/forum/discuss.php?d=42266#p238417 explains another way to fix the problem, that is:

        Make sure that there are no extra lines at the end of config.php. It needs to end with just ?>
        No white spaces or line breaks or anything should appear after these characters.

        Show
        Luis de Vasconcelos added a comment - http://moodle.org/mod/forum/discuss.php?d=42266#p238417 explains another way to fix the problem, that is: Make sure that there are no extra lines at the end of config.php. It needs to end with just ?> No white spaces or line breaks or anything should appear after these characters.
        Hide
        Petr Škoda added a comment -

        This should be finally fixed now in 2.0dev. The cookie test was rewritten and session code does some more diagnostics.
        Please test and report new issues if necessary.

        Thank you for the report.

        Petr Skoda

        Show
        Petr Škoda added a comment - This should be finally fixed now in 2.0dev. The cookie test was rewritten and session code does some more diagnostics. Please test and report new issues if necessary. Thank you for the report. Petr Skoda

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: