$signup = '';
}
- $username = get_moodle_cookie();
+ if (get_moodle_cookie() == '') {
+ set_moodle_cookie('nobody'); // To help search for cookies
+ }
+
+ $username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
+
if (empty($USER->loggedin)) {
$this->content->text = "<form name=\"blocklogin\" method=\"post\"";
$this->content->text .= " action=\"". $wwwroot ."/login/index.php\">\n";
$string['continue'] = 'Continue';
$string['continuetocourse'] = 'Click here to enter your course';
$string['cookiesenabled'] = 'Cookies must be enabled in your browser';
+$string['cookiesnotenabled'] = 'Unfortunately, cookies are currently not enabled in your browser';
$string['copy'] = 'copy';
$string['copyingcoursefiles'] = 'Copying course files';
$string['copyinguserfiles'] = 'Copying user files';
$frm = data_submitted();
}
- if ($frm) {
+ if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
+
+ $errormsg = get_string("cookiesnotenabled");
+
+ } else if ($frm) { // Login WITH cookies
+
+ if (get_moodle_cookie() == '') {
+ error('Cookies not working!');
+ die;
+ }
+
$frm->username = trim(moodle_strtolower($frm->username));
if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) {
if (empty($SESSION->wantsurl)) {
$SESSION->wantsurl = array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER["HTTP_REFERER"] : $CFG->wwwroot;
}
+
+ if (get_moodle_cookie() == '') {
+ set_moodle_cookie('nobody'); // To help search for cookies
+ }
if (empty($frm->username)) {
- $frm->username = get_moodle_cookie();
+ $frm->username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
$frm->password = "";
}