/** * Generates the login form for the sideblock. * * {@internal{Not sure why this form definition doesn't use * auth_get_login_form, but keep that in mind when making changes.}} */ function auth_generate_login_form() { global $SESSION; require_once 'pieforms/pieform.php'; if (!get_config('installed')) { return; } else { if ($SESSION->loginform) { return get_login_form_js($SESSION->loginform->build()); } } $elements = auth_get_login_form_elements(); $loginform = get_login_form_js(pieform(array('name' => 'login', 'renderer' => 'div', 'submit' => false, 'plugintype' => 'auth', 'pluginname' => 'internal', 'autofocus' => false, 'elements' => $elements))); return $loginform; }
/** * Generates the login form specifically independent of the core Mahara one * we want a custom submit callback here - which PHP doesn't let you do via overloading (sigh) * so - the only thing that is different here is the form name and the successcallback, and submit = true * */ function saml_auth_generate_login_form() { if (!get_config('installed')) { return; } require_once 'pieforms/pieform.php'; if (count_records('institution', 'registerallowed', 1, 'suspended', 0)) { $registerlink = '<a href="' . get_config('wwwroot') . 'register.php">' . get_string('register') . '</a><br>'; } else { $registerlink = ''; } $loginform = get_login_form_js(pieform(array('name' => 'auth_saml_login', 'renderer' => 'div', 'submit' => true, 'successcallback' => 'auth_saml_login_submit', 'plugintype' => 'auth', 'pluginname' => 'internal', 'autofocus' => false, 'elements' => array('login_username' => array('type' => 'text', 'title' => get_string('username') . ':', 'description' => get_string('usernamedescription'), 'defaultvalue' => isset($_POST['login_username']) ? $_POST['login_username'] : '', 'rules' => array('required' => true)), 'login_password' => array('type' => 'password', 'title' => get_string('password') . ':', 'description' => get_string('passworddescription'), 'defaultvalue' => '', 'rules' => array('required' => true)), 'submit' => array('type' => 'submit', 'value' => get_string('login')), 'register' => array('value' => '<div id="login-helplinks">' . $registerlink . '<a href="' . get_config('wwwroot') . 'forgotpass.php">' . get_string('lostusernamepassword') . '</a></div>'), 'loginsaml' => array('value' => count_records('auth_instance', 'authname', 'saml') == 0 ? '' : '<a href="' . get_config('wwwroot') . 'auth/saml/index.php">' . get_string('login', 'auth.saml') . '</a>'))))); return $loginform; }
/** * Generates the login form for the sideblock * * {@internal{Not sure why this form definition doesn't use * auth_get_login_form, but keep that in mind when making changes.}} */ function auth_generate_login_form() { if (!get_config('installed')) { return; } require_once 'pieforms/pieform.php'; $loginform = get_login_form_js(pieform(array('name' => 'login', 'renderer' => 'div', 'submit' => false, 'plugintype' => 'auth', 'pluginname' => 'internal', 'elements' => array('login_username' => array('type' => 'text', 'title' => get_string('username') . ':', 'description' => get_string('usernamedescription'), 'defaultvalue' => isset($_POST['login_username']) ? $_POST['login_username'] : '', 'rules' => array('required' => true)), 'login_password' => array('type' => 'password', 'title' => get_string('password') . ':', 'description' => get_string('passworddescription'), 'defaultvalue' => ''), 'submit' => array('type' => 'submit', 'value' => get_string('login')), 'register' => array('value' => '<div><a href="' . get_config('wwwroot') . 'register.php" tabindex="2">' . get_string('register') . '</a>' . '<br><a href="' . get_config('wwwroot') . 'forgotpass.php" tabindex="2">' . get_string('lostusernamepassword') . '</a></div>'))))); return $loginform; }
/** * Generate the login form for $this->showloginform(). * * @return array Array of pieform form information for the login form. */ public function generate_login_form() { return get_login_form_js(pieform(array('name' => 'auth_oidc_login', 'renderer' => 'div', 'submit' => true, 'successcallback' => array($this, 'login_submit'), 'plugintype' => 'auth', 'pluginname' => 'internal', 'autofocus' => false, 'iscancellable' => true, 'elements' => array('login_username' => array('type' => 'text', 'title' => get_string('username') . ':', 'description' => get_string('usernamedescription'), 'defaultvalue' => isset($_POST['login_username']) ? $_POST['login_username'] : '', 'rules' => array('required' => true)), 'login_password' => array('type' => 'password', 'title' => get_string('password') . ':', 'description' => get_string('passworddescription'), 'defaultvalue' => '', 'rules' => array('required' => true)), 'submit' => array('class' => 'btn-primary btn-block', 'type' => 'submitcancel', 'value' => array(get_string('login'), get_string('cancel'))))))); }
/** * Generates the login form for the sideblock * * {@internal{Not sure why this form definition doesn't use * auth_get_login_form, but keep that in mind when making changes.}} */ function auth_generate_login_form() { if (!get_config('installed')) { return; } $action = ''; if (get_config('httpswwwroot')) { $action = rtrim(get_config('httpswwwroot'), '/') . strip_querystring(get_relative_script_path()); } require_once 'pieforms/pieform.php'; if (count_records('institution', 'registerallowed', 1, 'suspended', 0)) { $registerlink = '<a href="' . get_config('wwwroot') . 'register.php" tabindex="2">' . get_string('register') . '</a><br>'; } else { $registerlink = ''; } $loginform = get_login_form_js(pieform(array('name' => 'login', 'renderer' => 'div', 'submit' => false, 'action' => $action, 'plugintype' => 'auth', 'pluginname' => 'internal', 'autofocus' => false, 'elements' => array('login_username' => array('type' => 'text', 'title' => get_string('username') . ':', 'description' => get_string('usernamedescription'), 'defaultvalue' => isset($_POST['login_username']) ? $_POST['login_username'] : '', 'rules' => array('required' => true)), 'login_password' => array('type' => 'password', 'title' => get_string('password') . ':', 'description' => get_string('passworddescription'), 'defaultvalue' => '', 'rules' => array('required' => true)), 'submit' => array('type' => 'submit', 'value' => get_string('login')), 'register' => array('value' => '<div id="login-helplinks">' . $registerlink . '<a href="' . get_config('wwwroot') . 'forgotpass.php" tabindex="2">' . get_string('lostusernamepassword') . '</a></div>'))))); return $loginform; }