. /** * Login block * * @package block_login * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class block_login extends block_base { function init() { $this->title = get_string('pluginname', 'block_login'); } function applicable_formats() { return array('site' => true); } function get_content () { global $USER, $CFG, $SESSION, $OUTPUT; require_once($CFG->libdir . '/authlib.php'); $wwwroot = ''; $signup = ''; if ($this->content !== NULL) { return $this->content; } $wwwroot = $CFG->wwwroot; if (signup_is_enabled()) { $signup = $wwwroot . '/login/signup.php'; } // TODO: now that we have multiauth it is hard to find out if there is a way to change password $forgot = $wwwroot . '/login/forgot_password.php'; $username = get_moodle_cookie(); $this->content = new stdClass(); $this->content->footer = ''; $this->content->text = ''; if (!isloggedin() or isguestuser()) { // Show the block if (empty($CFG->authloginviaemail)) { $strusername = get_string('username'); } else { $strusername = get_string('usernameemail'); } $this->content->text .= "\n".'
\n"; if (!empty($signup)) { $this->content->text .= ''; } if (!empty($forgot)) { $this->content->text .= ''; } $authsequence = get_enabled_auth_plugins(); // Get all auths, in sequence. $potentialidps = array(); foreach ($authsequence as $authname) { $authplugin = get_auth_plugin($authname); $potentialidps = array_merge($potentialidps, $authplugin->loginpage_idp_list($this->page->url->out(false))); } if (!empty($potentialidps)) { $this->content->text .= '