From 0e8a3f25e16a3c7ac95e3f645296ffa01b300298 Mon Sep 17 00:00:00 2001 From: fiedorow Date: Tue, 15 Feb 2005 16:14:55 +0000 Subject: [PATCH] just a hook for weblink authentication --- login/index.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/login/index.php b/login/index.php index 8cf423548b8..9e5054d1165 100644 --- a/login/index.php +++ b/login/index.php @@ -43,10 +43,22 @@ $frm = false; + $user = false; if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,"username=guest")) or $loginguest) { /// Log in as guest automatically (idea from Zbigniew Fiedorowicz) $frm->username = "guest"; $frm->password = "guest"; + } else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot . "/login/weblinkauth.php")) { + //Handles the case of another Moodle site linking into a page on this site + include $CFG->dirroot . "/login/weblinkauth.php"; + if (function_exists(weblink_auth)) { + $user = weblink_auth($SESSION->wantsurl); + } + if ($user) { + $frm->username = $user->username; + } else { + $frm = data_submitted(); + } } else { $frm = data_submitted(); } @@ -62,7 +74,7 @@ if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) { $user = false; /// Can't log in as guest if guest button is disabled $frm = false; - } else { + } else if (!$user) { $user = authenticate_user_login($frm->username, $frm->password); } update_login_count();