/** * */ public function login() { $this->_loadStorage(); if (!empty($this->username) && 'anonymous' != $this->username && $this->storage->supportsCaptchaVerification()) { require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if (ilCaptchaUtil::isActiveForLogin()) { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI('', 'captcha_code'); $captcha->setRequired(true); if (!$captcha->checkInput()) { $this->log('Captcha verification failed'); $this->status = AUTH_CAPTCHA_INVALID; return; } } } parent::login(); }
/** * Init captcha form. */ public function initCaptchaForm() { /** * @var $lng ilLanguage * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $ci = new ilCaptchaInputGUI($lng->txt('cont_captcha_code'), 'captcha_code'); $ci->setRequired(true); $form->addItem($ci); $form->addCommandButton('edit', $lng->txt('ok')); $form->setTitle($lng->txt('cont_captcha_verification')); $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }
/** * 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; }
private function initTopicCreateForm() { /** * @var $ilUser ilObjUser * @var $rbacsystem ilRbacSystem * @var $ilias ILIAS * @var $ilSetting ilSetting */ global $ilUser, $rbacsystem, $ilias, $ilSetting; $this->create_topic_form_gui = new ilPropertyFormGUI(); $this->create_topic_form_gui->setTitle($this->lng->txt('forums_new_thread')); $this->create_topic_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg')); $this->create_topic_form_gui->setTableWidth('100%'); // form action $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'addThread')); if ($this->objProperties->isAnonymized() == 1) { $alias_gui = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias'); $alias_gui->setInfo($this->lng->txt('forums_use_alias')); $alias_gui->setMaxLength(255); $alias_gui->setSize(50); $this->create_topic_form_gui->addItem($alias_gui); } else { $alias_gui = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias'); $alias_gui->setValue($ilUser->getLogin()); $this->create_topic_form_gui->addItem($alias_gui); } // topic $subject_gui = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject'); $subject_gui->setMaxLength(255); $subject_gui->setSize(50); $subject_gui->setRequired(true); $this->create_topic_form_gui->addItem($subject_gui); // message $post_gui = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message'); $post_gui->setCols(50); $post_gui->setRows(15); $post_gui->setRequired(true); $post_gui->setUseRte(true); $post_gui->addPlugin('latex'); $post_gui->addButton('latex'); $post_gui->addButton('pastelatex'); $post_gui->addPlugin('ilfrmquote'); //$post_gui->addPlugin('code'); $post_gui->removePlugin('advlink'); $post_gui->usePurifier(true); $post_gui->setRTERootBlockElement(''); $post_gui->setRTESupport($ilUser->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7'); $post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect')); // purifier require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php'; $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post')); $this->create_topic_form_gui->addItem($post_gui); // file $fi = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile'); $fi->setFilenames(array(0 => '')); $this->create_topic_form_gui->addItem($fi); include_once 'Services/Mail/classes/class.ilMail.php'; $umail = new ilMail($ilUser->getId()); // catch hack attempts if ($rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) && !$this->objProperties->isAnonymized()) { // direct notification $dir_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify'); $dir_notification_gui->setInfo($this->lng->txt('forum_notify_me_directly')); $dir_notification_gui->setValue(1); $this->create_topic_form_gui->addItem($dir_notification_gui); if ($ilias->getSetting('forum_notification') != 0) { // gen. notification $gen_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_general_notification'), 'notify_posts'); $gen_notification_gui->setInfo($this->lng->txt('forum_notify_me_generally')); $gen_notification_gui->setValue(1); $this->create_topic_form_gui->addItem($gen_notification_gui); } } require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) { require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code'); $captcha->setRequired(true); $this->create_topic_form_gui->addItem($captcha); } $this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create')); $this->create_topic_form_gui->addCommandButton('showThreads', $this->lng->txt('cancel')); }
protected function __initForm() { global $lng, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); // code handling if ($this->code_enabled) { include_once 'Services/Registration/classes/class.ilRegistrationCode.php'; $code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code"); $code->setSize(40); $code->setMaxLength(ilRegistrationCode::CODE_LENGTH); if ((bool) $this->registration_settings->registrationCodeRequired()) { $code->setRequired(true); $code->setInfo($lng->txt("registration_code_required_info")); } else { $code->setInfo($lng->txt("registration_code_optional_info")); } $this->form->addItem($code); } // user defined fields $user_defined_data = $ilUser->getUserDefinedData(); include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields =& ilUserDefinedFields::_getInstance(); $custom_fields = array(); foreach ($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition) { if ($definition['field_type'] == UDF_TYPE_TEXT) { $custom_fields["udf_" . $definition['field_id']] = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]); $custom_fields["udf_" . $definition['field_id']]->setMaxLength(255); $custom_fields["udf_" . $definition['field_id']]->setSize(40); } else { if ($definition['field_type'] == UDF_TYPE_WYSIWYG) { $custom_fields["udf_" . $definition['field_id']] = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]); $custom_fields["udf_" . $definition['field_id']]->setUseRte(true); } else { $custom_fields["udf_" . $definition['field_id']] = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]); $custom_fields["udf_" . $definition['field_id']]->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values'])); } } if ($definition['required']) { $custom_fields["udf_" . $definition['field_id']]->setRequired(true); } } // standard fields include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); $up->setMode(ilUserProfile::MODE_REGISTRATION); $up->skipGroup("preferences"); // add fields to form $up->addStandardFieldsToForm($this->form, NULL, $custom_fields); unset($custom_fields); // set language selection to current display language $flang = $this->form->getItemByPostVar("usr_language"); if ($flang) { $flang->setValue($lng->getLangKey()); } // add information to role selection (if not hidden) if ($this->code_enabled) { $role = $this->form->getItemByPostVar("usr_roles"); if ($role && $role->getType() == "select") { $role->setInfo($lng->txt("registration_code_role_info")); } } // #11407 $domains = array(); foreach ($this->registration_settings->getAllowedDomains() as $item) { if (trim($item)) { $domains[] = $item; } } if (sizeof($domains)) { $mail_obj = $this->form->getItemByPostVar('usr_email'); $mail_obj->setInfo(sprintf($lng->txt("reg_email_domains"), implode(", ", $domains)) . "<br />" . ($this->code_enabled ? $lng->txt("reg_email_domains_code") : "")); } if (ilTermsOfServiceHelper::isEnabled()) { try { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php'; $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng); $field = new ilFormSectionHeaderGUI(); $field->setTitle($lng->txt('usr_agreement')); $this->form->addItem($field); $field = new ilCustomInputGUI(); $field->setHTML('<div id="agreement">' . $document->getContent() . '</div>'); $this->form->addItem($field); $field = new ilCheckboxInputGUI($lng->txt('accept_usr_agreement'), 'accept_terms_of_service'); $field->setRequired(true); $field->setValue(1); $this->form->addItem($field); } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) { } } require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if (ilCaptchaUtil::isActiveForRegistration()) { require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI($lng->txt("captcha_code"), 'captcha_code'); $captcha->setRequired(true); $this->form->addItem($captcha); } $this->form->addCommandButton("saveForm", $lng->txt("register")); }
/** * Init captcha form. */ public function initCaptchaForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); // captcha code include_once "./Services/Captcha/classes/class.ilCaptchaInputGUI.php"; $ci = new ilCaptchaInputGUI($lng->txt("cont_captcha_code"), "captcha_code"); $ci->setRequired(true); $form->addItem($ci); $form->addCommandButton("edit", $lng->txt("ok")); $form->setTitle($lng->txt("cont_captcha_verification")); $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }