moodle 1.4 - block login sends user to login page?

moodle 1.4 - block login sends user to login page?

by Carlos Vargas -
Number of replies: 12
I just upgraded to moodle 1.4. A fabulous piece of work as always. But, I added a login block to my home page, and it sends users to ../login/index.php instead of performing the actual login. Does this sound like I'm doing something wrong?
Average of ratings: -
In reply to Carlos Vargas

Re: moodle 1.4 - block login sends user to login page?

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
That's not how it works for me ... try renaming your config.php to something else and letting the new Moodle installer create you a new one.  Make sure you using the same database settings so you don't lose your site.
In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by Carlos Vargas -
Thanks Martin,

I tried with and without the installer. I tried a lot of other things and was very careful with all files. But the same problem persists. I am not able to login using the block login on the home page. It still takes me to the main login page. black eye
In reply to Carlos Vargas

Re: moodle 1.4 - block login sends user to login page?

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
Make sure secureforms is switched off in Admin >> Configuration >> Variables.
In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Is there something to do if I want to preserve the additional security for the forms?

That is: is there a way to make it work with secureforms switched on?

Nicolas
In reply to Nicolas Martignoni

Re: moodle 1.4 - block login sends user to login page?

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
You could get rid of the login block... wink

We could also add the home page to the list of allowed referers for forms, I guess. This would be in the match_referer function in lib/weblib.php, by changing it to something like this:

function match_referer($goodreferer = "") {
/// returns true if the referer is the same as the goodreferer.  If
/// goodreferer is not specified, use qualified_me as the goodreferer
    global $CFG;

    if (empty($CFG->secureforms)) {    // Don't bother checking referer
        return true;
    }

    if ($goodreferer == "nomatch") {   // Don't bother checking referer
        return true;
    }

    if (empty($goodreferer)) {
        $goodreferer = qualified_me();
    }
   
    $referer = get_referer();

    return (($referer == $goodreferer) or ($referer == "$CFG->wwwroot/"));
}


In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by Marc Dastous -

Does anyone know if this worked?  I had the same problem when I added the new Login block.  And just as Martin said, I turned off the secure forms and it worked like a charm.

Marc

In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by Herbert Keijers -
Marc,
I experienced the same problem on a testing machine
Changed the apropriate lines as Martin suggested.
It is working now with secureforms turned on.

Martin, will this be in cvs ?

In reply to Herbert Keijers

Re: moodle 1.4 - block login sends user to login page?

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
Oh yes, I put it in stable and dev.  I think it might be useful for other "shortcut" type blocks.
In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by Nicolas Martignoni -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Many thanks, Martin!

Always so quick big grin

Cheers and congrat for the 1.4
Nicolas
In reply to Herbert Keijers

Re: moodle 1.4 - block login sends user to login page?

by Marc Dastous -

Herbert,

Thank you for the confirmation.  I have implemented the changes and they work fine.

Can anyone tell me how I would get the cursor to automagically appear in the User Name or Password field in this block, when the page loads?  For example, if the user name is cached, how can I get the cursor to appear in the password field?

Marc

In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by Carlos Vargas -
Thanks, yet again, Martin. Switching off the secureforms solved the problem perfectly.

Cheers
In reply to Martin Dougiamas

Re: moodle 1.4 - block login sends user to login page?

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Note that secureforms switched on was the reason for problems with inserting the first page of Lesson module. In the discussion some suggestions for form security mechanism appeared...