Authentication issues

Authentication issues

by Jason Shuler -
Number of replies: 9

I'm having a lot of trouble with users getting logged out at random. Every computer I have accessed moodle from has cookies enables, but I regularly get thrown back to the login screen after clicking a link (especially after completing the description for an assignment). I tested the system with a student a few days ago, and it happened to him after he clicked on his first link.

That is, he could log in just fine, it had his name at the top, then he clicked on an assignment and it sent him to the login screen.

All the computers in the lab have cookies enabled. My computer at home does as well. Yet all the compters have this problem.

I'd really like to get my students using the system, but with a slow as these computers are, they don't have time to be logging in every few links.

Thanks for your help!

-Jason

Average of ratings: -
In reply to Jason Shuler

Re: Authentication issues

by Scot Gardner -
I was having this same issue earlier this week, and it can be a real problem if the students are half way through a 200 question quiz.

Scot
In reply to Jason Shuler

Re: Authentication issues

by Jason Shuler -

Thought I should mention, moodle is installed in a subdirectory of my domain on a shared host running php 4.3.3, apache 1.3.29 and mysql 4.0.18-standard.

I've used both 1.2 beta and 1.2.1 and had the same problems. If you need any other info, let me know.

-Jason

In reply to Jason Shuler

Re: Authentication issues

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It's most likely that your setting for $CFG->wwwroot is wrong in config.php.  Try adding or removing the www from the URL.  Post the actual URL if you can't solve it.
In reply to Martin Dougiamas

Re: Authentication issues

by Duncan Macneil -

I HAVE FINALLY SOLVED THIS!

A default PHP installation will log a user out after 24 minutes REGARDLESS of what the moodle edit time and moodle session times are. This is because a default php.ini file has the value session.gc_maxlifetime set to 1440 seconds. (24 mins)

If you can't access the php.ini (many ISP do not alow this) then you can set it in a .htaccess file with one line (put the .htaccess file in the root moodle dir):

php_value session.gc_maxlifetime "86400"

I tried using set_ini() in the config.php file, but by the time the config file is loaded, the session cookies have been set.

Martin, I would recommend adding such a .htaccess file to the standard distribution so that moodle edit and session times work properly.

As you can imagine, a user gets really mad if they finish 80+ questions only to have their answers lost when the session times out.

Hope this helps others.

In reply to Duncan Macneil

Re: Authentication issues

by Jason Shuler -

I will definitely try adding that to my .htaccess file, however this is happening after only 5 minutes. It happened just today while I was typing out an assignment. Took at most 10 minutes and when I clicked submit, it bounced to the login screen. When I log back in, it says something like "no action was performed", and backing up reveals an empty form. Lucky for me I copied my text expecting this...

Thanks for the help thus far! Any more ideas?

In reply to Jason Shuler

Re: Authentication issues

by Bryan Williams -

Jason,

This may be unrelated, but I'll mention it anyway.  I have experienced a similiar problem with being bounced to the login screen under circumstances you describe.  Here is what I discovered. 

I added resources to course B (Moodle site 2) that were originally created in course A (Moodle site 1), by copying descriptions (that contained links) to the clipboard and then simply pasted away.  I actually did a similar stupid thing with some graphics that I reused.  Things would act normal in course B, until I did something that called the link from couse A.  So, Moodle doing exactly like it's supposed to do would take me to the login screen for course A so it could load the link.  Once I discovered what was happening (I'm bald now), simply fixing the links to various resources within course B made the problem go away.  Sometimes a problem has a very simple answer; in this case, it was operator stupidity.

Hope this helps,

Bryan

     

In reply to Duncan Macneil

Re: Authentication issues

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I used to include such a .htaccess file, but it actually causes errors on some webhosts, so it's left out. See lib/htaccess.

Duncan's issue is actually competely different to Jason's.
In reply to Martin Dougiamas

Re: Authentication issues

by Jason Shuler -
I always access it using www., and the www. is in the $CFG->wwwroot. Should I remove it even though I use the www?