Issue Details (XML | Word | Printable)

Key: MDL-17564
Type: Sub-task Sub-task
Status: Open Open
Priority: Minor Minor
Assignee: Petr Skoda
Reporter: William Jeffery Haslam
Votes: 1
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-17754

Unfortunately cookies are currently not enabled in your browser

Created: 09/Dec/08 06:22 PM   Updated: 26/Aug/09 12:57 PM
Return to search
Component/s: Authentication, General, Lib
Affects Version/s: 1.9.3
Fix Version/s: 2.0

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
URL: www.acted.co.za
Participants: Eloy Lafuente (stronk7), Jani Lemmetyinen, Luis de Vasconcelos, Petr Skoda and William Jeffery Haslam
Security Level: None
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
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.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Jani Lemmetyinen added a comment - 12/Jan/09 10:44 PM
Find this with IE 6.5 as well. Safari and Firefox running OK.

William Jeffery Haslam added a comment - 13/Jan/09 04:32 PM
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.


Eloy Lafuente (stronk7) added a comment - 15/Jan/09 01:20 AM
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.

Petr Skoda added a comment - 15/Jan/09 02:05 AM
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


Luis de Vasconcelos added a comment - 26/Aug/09 12:57 PM
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.