Exemplo n.º 1
0
 /**
  * Show login form 
  * @global ilSetting $ilSetting
  * @param string $page_editor_html 
  */
 protected function showLoginForm($page_editor_html)
 {
     global $ilSetting, $lng, $tpl;
     // @todo move this to auth utils.
     // login via ILIAS (this also includes radius and ldap)
     // If local authentication is enabled for shibboleth users, we
     // display the login form for ILIAS here.
     if (($ilSetting->get("auth_mode") != AUTH_SHIBBOLETH || $ilSetting->get("shib_auth_allow_local")) && $ilSetting->get("auth_mode") != AUTH_CAS) {
         include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
         $form = new ilPropertyFormGUI();
         //$form->setTableWidth('500');
         $form->setFormAction($this->ctrl->getFormAction($this, ''));
         $form->setName("formlogin");
         $form->setShowTopButtons(false);
         $form->setTitle($lng->txt("login_to_ilias"));
         // auth selection
         include_once './Services/Authentication/classes/class.ilAuthModeDetermination.php';
         $det = ilAuthModeDetermination::_getInstance();
         if (ilAuthUtils::_hasMultipleAuthenticationMethods() and $det->isManualSelection()) {
             $visible_auth_methods = array();
             $radg = new ilRadioGroupInputGUI($lng->txt("auth_selection"), "auth_mode");
             foreach (ilAuthUtils::_getMultipleAuthModeOptions($lng) as $key => $option) {
                 if (isset($option['hide_in_ui']) && $option['hide_in_ui']) {
                     continue;
                 }
                 $op1 = new ilRadioOption($option['txt'], $key);
                 $radg->addOption($op1);
                 if (isset($option['checked'])) {
                     $radg->setValue($key);
                 }
                 $visible_auth_methods[] = $op1;
             }
             if (count($visible_auth_methods) == 1) {
                 $first_auth_method = current($visible_auth_methods);
                 $hidden_auth_method = new ilHiddenInputGUI("auth_mode");
                 $hidden_auth_method->setValue($first_auth_method->getValue());
                 $form->addItem($hidden_auth_method);
             } else {
                 $form->addItem($radg);
             }
         }
         $ti = new ilTextInputGUI($lng->txt("username"), "username");
         $ti->setSize(20);
         $ti->setRequired(true);
         $form->addItem($ti);
         $pi = new ilPasswordInputGUI($lng->txt("password"), "password");
         $pi->setRetype(false);
         $pi->setSize(20);
         $pi->setDisableHtmlAutoComplete(false);
         $pi->setRequired(true);
         $form->addItem($pi);
         $form->addCommandButton("showLogin", $lng->txt("log_in"));
         require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
         if (ilCaptchaUtil::isActiveForLogin()) {
             require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
             $captcha = new ilCaptchaInputGUI($lng->txt('captcha_code'), 'captcha_code');
             $captcha->setRequired(true);
             $form->addItem($captcha);
         }
         return $this->substituteLoginPageElements($tpl, $page_editor_html, $form->getHTML(), '[list-login-form]', 'LOGIN_FORM');
     }
     return $page_editor_html;
 }