ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAccountRegistrationGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
18 require_once './Services/Registration/classes/class.ilRegistrationSettings.php';
19 require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
20 
25 {
26  protected $registration_settings; // [object]
27  protected $code_enabled; // [bool]
28  protected $code_was_used; // [bool]
30  protected $userObj;
31 
32  public function __construct()
33  {
34  global $ilCtrl,$tpl,$lng;
35 
36  $this->tpl =&$tpl;
37 
38  $this->ctrl =&$ilCtrl;
39  $this->ctrl->saveParameter($this, 'lang');
40 
41  $this->lng =&$lng;
42  $this->lng->loadLanguageModule('registration');
43 
44  $this->registration_settings = new ilRegistrationSettings();
45 
46  $this->code_enabled = ($this->registration_settings->registrationCodeRequired() ||
47  $this->registration_settings->getAllowCodes());
48  }
49 
50  public function executeCommand()
51  {
52  global $ilErr, $tpl;
53 
54  if ($this->registration_settings->getRegistrationType() == IL_REG_DISABLED) {
55  $ilErr->raiseError($this->lng->txt('reg_disabled'), $ilErr->FATAL);
56  }
57 
58  $next_class = $this->ctrl->getNextClass($this);
59  $cmd = $this->ctrl->getCmd();
60 
61  switch ($next_class) {
62  default:
63  if ($cmd) {
64  $this->$cmd();
65  } else {
66  $this->displayForm();
67  }
68  break;
69  }
70  $tpl->setPermanentLink('usr', null, 'registration');
71  $tpl->show();
72  return true;
73  }
74 
78  public function displayForm()
79  {
83  global $lng;
84 
85  ilStartUpGUI::initStartUpTemplate(array('tpl.usr_registration.html', 'Services/Registration'), true);
86  $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('registration'));
87 
88  if (!$this->form) {
89  $this->__initForm();
90  }
91  $this->tpl->setVariable('FORM', $this->form->getHTML());
92  }
93 
94  protected function __initForm()
95  {
96  global $lng, $ilUser;
97 
98  // needed for multi-text-fields (interests)
99  include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
101 
102  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
103  $this->form = new ilPropertyFormGUI();
104  $this->form->setFormAction($this->ctrl->getFormAction($this));
105 
106 
107  // code handling
108 
109  if ($this->code_enabled) {
110  include_once 'Services/Registration/classes/class.ilRegistrationCode.php';
111  $code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code");
112  $code->setSize(40);
113  $code->setMaxLength(ilRegistrationCode::CODE_LENGTH);
114  if ((bool) $this->registration_settings->registrationCodeRequired()) {
115  $code->setRequired(true);
116  $code->setInfo($lng->txt("registration_code_required_info"));
117  } else {
118  $code->setInfo($lng->txt("registration_code_optional_info"));
119  }
120  $this->form->addItem($code);
121  }
122 
123 
124  // user defined fields
125 
126  $user_defined_data = $ilUser->getUserDefinedData();
127 
128  include_once './Services/User/classes/class.ilUserDefinedFields.php';
129  $user_defined_fields =&ilUserDefinedFields::_getInstance();
130  $custom_fields = array();
131  foreach ($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition) {
132  if ($definition['field_type'] == UDF_TYPE_TEXT) {
133  $custom_fields["udf_" . $definition['field_id']] =
134  new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
135  $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
136  $custom_fields["udf_" . $definition['field_id']]->setMaxLength(255);
137  $custom_fields["udf_" . $definition['field_id']]->setSize(40);
138  } elseif ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
139  $custom_fields["udf_" . $definition['field_id']] =
140  new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
141  $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
142  $custom_fields["udf_" . $definition['field_id']]->setUseRte(true);
143  } else {
144  $custom_fields["udf_" . $definition['field_id']] =
145  new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
146  $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]);
147  $custom_fields["udf_" . $definition['field_id']]->setOptions(
148  $user_defined_fields->fieldValuesToSelectArray($definition['field_values'])
149  );
150  }
151  if ($definition['required']) {
152  $custom_fields["udf_" . $definition['field_id']]->setRequired(true);
153  }
154 
155  if ($definition['field_type'] == UDF_TYPE_SELECT && !$user_defined_data["f_" . $field_id]) {
156  $options = $custom_fields["udf_" . $definition['field_id']]->getOptions();
157  $custom_fields["udf_" . $definition['field_id']]->setOptions($options);
158  }
159  }
160 
161  // standard fields
162  include_once("./Services/User/classes/class.ilUserProfile.php");
163  $up = new ilUserProfile();
164  $up->setMode(ilUserProfile::MODE_REGISTRATION);
165  $up->skipGroup("preferences");
166 
167  $up->setAjaxCallback(
168  $this->ctrl->getLinkTarget($this, 'doProfileAutoComplete', '', true)
169  );
170 
171  $lng->loadLanguageModule("user");
172 
173  // add fields to form
174  $up->addStandardFieldsToForm($this->form, null, $custom_fields);
175  unset($custom_fields);
176 
177 
178  // set language selection to current display language
179  $flang = $this->form->getItemByPostVar("usr_language");
180  if ($flang) {
181  $flang->setValue($lng->getLangKey());
182  }
183 
184  // add information to role selection (if not hidden)
185  if ($this->code_enabled) {
186  $role = $this->form->getItemByPostVar("usr_roles");
187  if ($role && $role->getType() == "select") {
188  $role->setInfo($lng->txt("registration_code_role_info"));
189  }
190  }
191 
192  // #11407
193  $domains = array();
194  foreach ($this->registration_settings->getAllowedDomains() as $item) {
195  if (trim($item)) {
196  $domains[] = $item;
197  }
198  }
199  if (sizeof($domains)) {
200  $mail_obj = $this->form->getItemByPostVar('usr_email');
201  $mail_obj->setInfo(sprintf(
202  $lng->txt("reg_email_domains"),
203  implode(", ", $domains)
204  ) . "<br />" .
205  ($this->code_enabled ? $lng->txt("reg_email_domains_code") : ""));
206  }
207 
208  // #14272
209  if ($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION) {
210  $mail_obj = $this->form->getItemByPostVar('usr_email');
211  if ($mail_obj) { // #16087
212  $mail_obj->setRequired(true);
213  }
214  }
215 
216  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php';
218  if (ilTermsOfServiceHelper::isEnabled() && $document->exists()) {
219  $field = new ilFormSectionHeaderGUI();
220  $field->setTitle($lng->txt('usr_agreement'));
221  $this->form->addItem($field);
222 
223  $field = new ilCustomInputGUI();
224  $field->setHTML('<div id="agreement">' . $document->getContent() . '</div>');
225  $this->form->addItem($field);
226 
227  $field = new ilCheckboxInputGUI($lng->txt('accept_usr_agreement'), 'accept_terms_of_service');
228  $field->setRequired(true);
229  $field->setValue(1);
230  $this->form->addItem($field);
231  }
232 
233  require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
234  if (ilCaptchaUtil::isActiveForRegistration()) {
235  require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
236  $captcha = new ilCaptchaInputGUI($lng->txt("captcha_code"), 'captcha_code');
237  $captcha->setRequired(true);
238  $this->form->addItem($captcha);
239  }
240 
241  $this->form->addCommandButton("saveForm", $lng->txt("register"));
242  }
243 
244  public function saveForm()
245  {
246  global $lng, $ilSetting, $rbacreview;
247 
248  $this->__initForm();
249  $form_valid = $this->form->checkInput();
250 
251  require_once 'Services/User/classes/class.ilObjUser.php';
252 
253  // custom validation
254  $valid_code = $valid_role = false;
255 
256  // code
257  if ($this->code_enabled) {
258  $code = $this->form->getInput('usr_registration_code');
259  // could be optional
260  if (
261  $this->registration_settings->registrationCodeRequired() ||
262  strlen($code)
263  ) {
264  // code validation
265  include_once './Services/Registration/classes/class.ilRegistrationCode.php';
267  $code_obj = $this->form->getItemByPostVar('usr_registration_code');
268  $code_obj->setAlert($lng->txt('registration_code_not_valid'));
269  $form_valid = false;
270  } else {
271  $valid_code = true;
272 
273  // get role from code, check if (still) valid
274  $role_id = (int) ilRegistrationCode::getCodeRole($code);
275  if ($role_id && $rbacreview->isGlobalRole($role_id)) {
276  $valid_role = $role_id;
277  }
278  }
279  }
280  }
281 
282  // valid codes override email domain check
283  if (!$valid_code) {
284  // validate email against restricted domains
285  $email = $this->form->getInput("usr_email");
286  if ($email) {
287  // #10366
288  $domains = array();
289  foreach ($this->registration_settings->getAllowedDomains() as $item) {
290  if (trim($item)) {
291  $domains[] = $item;
292  }
293  }
294  if (sizeof($domains)) {
295  $mail_valid = false;
296  foreach ($domains as $domain) {
297  $domain = str_replace("*", "~~~", $domain);
298  $domain = preg_quote($domain);
299  $domain = str_replace("~~~", ".+", $domain);
300  if (preg_match("/^" . $domain . "$/", $email, $hit)) {
301  $mail_valid = true;
302  break;
303  }
304  }
305  if (!$mail_valid) {
306  $mail_obj = $this->form->getItemByPostVar('usr_email');
307  $mail_obj->setAlert(sprintf(
308  $lng->txt("reg_email_domains"),
309  implode(", ", $domains)
310  ));
311  $form_valid = false;
312  }
313  }
314  }
315  }
316 
317  $error_lng_var = '';
318  if (
319  !$this->registration_settings->passwordGenerationEnabled() &&
320  !ilUtil::isPasswordValidForUserContext($this->form->getInput('usr_password'), $this->form->getInput('username'), $error_lng_var)
321  ) {
322  $passwd_obj = $this->form->getItemByPostVar('usr_password');
323  $passwd_obj->setAlert($lng->txt($error_lng_var));
324  $form_valid = false;
325  }
326 
327  if (ilTermsOfServiceHelper::isEnabled() && !$this->form->getInput('accept_terms_of_service')) {
328  $agr_obj = $this->form->getItemByPostVar('accept_terms_of_service');
329  if ($agr_obj) {
330  $agr_obj->setAlert($lng->txt('force_accept_usr_agreement'));
331  } else {
332  ilUtil::sendFailure($lng->txt('force_accept_usr_agreement'));
333  }
334  $form_valid = false;
335  }
336 
337  // no need if role is attached to code
338  if (!$valid_role) {
339  // manual selection
340  if ($this->registration_settings->roleSelectionEnabled()) {
341  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
342  $selected_role = $this->form->getInput("usr_roles");
343  if ($selected_role && ilObjRole::_lookupAllowRegister($selected_role)) {
344  $valid_role = (int) $selected_role;
345  }
346  }
347  // assign by email
348  else {
349  include_once 'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
350  $registration_role_assignments = new ilRegistrationRoleAssignments();
351  $valid_role = (int) $registration_role_assignments->getRoleByEmail($this->form->getInput("usr_email"));
352  }
353  }
354 
355  // no valid role could be determined
356  if (!$valid_role) {
357  ilUtil::sendInfo($lng->txt("registration_no_valid_role"));
358  $form_valid = false;
359  }
360 
361  // validate username
362  $login_obj = $this->form->getItemByPostVar('username');
363  $login = $this->form->getInput("username");
364  $captcha = $this->form->getItemByPostVar("captcha_code");
365  if (!ilUtil::isLogin($login)) {
366  $login_obj->setAlert($lng->txt("login_invalid"));
367  $form_valid = false;
368  } elseif (ilObjUser::_loginExists($login)) {
369  if(!empty($captcha) && empty($captcha->getAlert()) || empty($captcha)) {
370  $login_obj->setAlert($lng->txt("login_exists"));
371  }
372  $form_valid = false;
373  } elseif ((int) $ilSetting->get('allow_change_loginname') &&
374  (int) $ilSetting->get('reuse_of_loginnames') == 0 &&
376  if(!empty($captcha) && empty($captcha->getAlert()) || empty($captcha)) {
377  $login_obj->setAlert($lng->txt("login_exists"));
378  }
379  $form_valid = false;
380  }
381 
382  if (!$form_valid) {
383  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
384  } else {
385  $password = $this->__createUser($valid_role);
387  $this->login($password);
388  return true;
389  }
390 
391  $this->form->setValuesByPost();
392  $this->displayForm();
393  return false;
394  }
395 
396  protected function __createUser($a_role)
397  {
403  global $ilSetting, $rbacadmin, $lng;
404 
405 
406  // something went wrong with the form validation
407  if (!$a_role) {
408  global $ilias;
409  $ilias->raiseError("Invalid role selection in registration" .
410  ", IP: " . $_SERVER["REMOTE_ADDR"], $ilias->error_obj->FATAL);
411  }
412 
413 
414  $this->userObj = new ilObjUser();
415 
416  include_once("./Services/User/classes/class.ilUserProfile.php");
417  $up = new ilUserProfile();
418  $up->setMode(ilUserProfile::MODE_REGISTRATION);
419 
420  $map = array();
421  $up->skipGroup("preferences");
422  $up->skipGroup("settings");
423  $up->skipField("password");
424  $up->skipField("birthday");
425  $up->skipField("upload");
426  foreach ($up->getStandardFields() as $k => $v) {
427  if ($v["method"]) {
428  $method = "set" . substr($v["method"], 3);
429  if (method_exists($this->userObj, $method)) {
430  if ($k != "username") {
431  $k = "usr_" . $k;
432  }
433  $field_obj = $this->form->getItemByPostVar($k);
434  if ($field_obj) {
435  $this->userObj->$method($this->form->getInput($k));
436  }
437  }
438  }
439  }
440 
441  $this->userObj->setFullName();
442 
443  $birthday_obj = $this->form->getItemByPostVar("usr_birthday");
444  if ($birthday_obj) {
445  $birthday = $this->form->getInput("usr_birthday");
446  $this->userObj->setBirthday($birthday);
447  }
448 
449  $this->userObj->setTitle($this->userObj->getFullname());
450  $this->userObj->setDescription($this->userObj->getEmail());
451 
452  if ($this->registration_settings->passwordGenerationEnabled()) {
454  $password = $password[0];
455  } else {
456  $password = $this->form->getInput("usr_password");
457  }
458  $this->userObj->setPasswd($password);
459 
460 
461  // Set user defined data
462  include_once './Services/User/classes/class.ilUserDefinedFields.php';
463  $user_defined_fields =&ilUserDefinedFields::_getInstance();
464  $defs = $user_defined_fields->getRegistrationDefinitions();
465  $udf = array();
466  foreach ($_POST as $k => $v) {
467  if (substr($k, 0, 4) == "udf_") {
468  $f = substr($k, 4);
469  $udf[$f] = $v;
470  }
471  }
472  $this->userObj->setUserDefinedData($udf);
473 
474  $this->userObj->setTimeLimitOwner(7);
475 
476 
477  $access_limit = null;
478 
479  $this->code_was_used = false;
480  if ($this->code_enabled) {
481  $code_local_roles = $code_has_access_limit = null;
482 
483  // #10853 - could be optional
484  $code = $this->form->getInput('usr_registration_code');
485  if ($code) {
486  include_once './Services/Registration/classes/class.ilRegistrationCode.php';
487 
488  // set code to used
490  $this->code_was_used = true;
491 
492  // handle code attached local role(s) and access limitation
494  if ($code_data["role_local"]) {
495  // need user id before we can assign role(s)
496  $code_local_roles = explode(";", $code_data["role_local"]);
497  }
498  if ($code_data["alimit"]) {
499  // see below
500  $code_has_access_limit = true;
501 
502  switch ($code_data["alimit"]) {
503  case "absolute":
504  $abs = date_parse($code_data["alimitdt"]);
505  $access_limit = mktime(23, 59, 59, $abs['month'], $abs['day'], $abs['year']);
506  break;
507 
508  case "relative":
509  $rel = unserialize($code_data["alimitdt"]);
510  $access_limit = $rel["d"] * 86400 + $rel["m"] * 2592000 +
511  $rel["y"] * 31536000 + time();
512  break;
513  }
514  }
515  }
516  }
517 
518  // code access limitation will override any other access limitation setting
519  if (!($this->code_was_used && $code_has_access_limit) &&
520  $this->registration_settings->getAccessLimitation()) {
521  include_once 'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
522  $access_limitations_obj = new ilRegistrationRoleAccessLimitations();
523  switch ($access_limitations_obj->getMode($a_role)) {
524  case 'absolute':
525  $access_limit = $access_limitations_obj->getAbsolute($a_role);
526  break;
527 
528  case 'relative':
529  $rel_d = (int) $access_limitations_obj->getRelative($a_role, 'd');
530  $rel_m = (int) $access_limitations_obj->getRelative($a_role, 'm');
531  $rel_y = (int) $access_limitations_obj->getRelative($a_role, 'y');
532  $access_limit = $rel_d * 86400 + $rel_m * 2592000 + $rel_y * 31536000 + time();
533  break;
534  }
535  }
536 
537  if ($access_limit) {
538  $this->userObj->setTimeLimitUnlimited(0);
539  $this->userObj->setTimeLimitUntil($access_limit);
540  } else {
541  $this->userObj->setTimeLimitUnlimited(1);
542  $this->userObj->setTimeLimitUntil(time());
543  }
544 
545  $this->userObj->setTimeLimitFrom(time());
546 
547  include_once './Services/User/classes/class.ilUserCreationContext.php';
549 
550  $this->userObj->create();
551 
552 
553  if ($this->registration_settings->getRegistrationType() == IL_REG_DIRECT ||
554  $this->registration_settings->getRegistrationType() == IL_REG_CODES ||
556  $this->userObj->setActive(1, 0);
557  } elseif ($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION) {
558  $this->userObj->setActive(0, 0);
559  } else {
560  $this->userObj->setActive(0, 0);
561  }
562 
563  $this->userObj->updateOwner();
564 
565  // set a timestamp for last_password_change
566  // this ts is needed by ilSecuritySettings
567  $this->userObj->setLastPasswordChangeTS(time());
568 
569  $this->userObj->setIsSelfRegistered(true);
570 
571  //insert user data in table user_data
572  $this->userObj->saveAsNew();
573 
574  require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php';
576 
577  // setup user preferences
578  $this->userObj->setLanguage($this->form->getInput('usr_language'));
579  $hits_per_page = $ilSetting->get("hits_per_page");
580  if ($hits_per_page < 10) {
581  $hits_per_page = 10;
582  }
583  $this->userObj->setPref("hits_per_page", $hits_per_page);
584  if (strlen($_GET['target']) > 0) {
585  $this->userObj->setPref('reg_target', ilUtil::stripSlashes($_GET['target']));
586  }
587  /*$show_online = $ilSetting->get("show_users_online");
588  if ($show_online == "")
589  {
590  $show_online = "y";
591  }
592  $this->userObj->setPref("show_users_online", $show_online);*/
593  $this->userObj->setPref('bs_allow_to_contact_me', $ilSetting->get('bs_allow_to_contact_me', 'n'));
594  $this->userObj->setPref('chat_osc_accept_msg', $ilSetting->get('chat_osc_accept_msg', 'n'));
595  $this->userObj->writePrefs();
596 
597 
598  $rbacadmin->assignUser((int) $a_role, $this->userObj->getId());
599 
600  // local roles from code
601  if ($this->code_was_used && is_array($code_local_roles)) {
602  foreach (array_unique($code_local_roles) as $local_role_obj_id) {
603  // is given role (still) valid?
604  if (ilObject::_lookupType($local_role_obj_id) == "role") {
605  $rbacadmin->assignUser($local_role_obj_id, $this->userObj->getId());
606 
607  // patch to remove for 45 due to mantis 21953
608  $role_obj = $GLOBALS['rbacreview']->getObjectOfRole($local_role_obj_id);
609  switch (ilObject::_lookupType($role_obj)) {
610  case 'crs':
611  case 'grp':
612  $role_refs = ilObject::_getAllReferences($role_obj);
613  $role_ref = end($role_refs);
614  ilObjUser::_addDesktopItem($this->userObj->getId(), $role_ref, ilObject::_lookupType($role_obj));
615  break;
616  }
617  }
618  }
619  }
620 
621  return $password;
622  }
623 
624  protected function __distributeMails($password)
625  {
626  global $ilSetting;
627 
628  include_once './Services/Language/classes/class.ilLanguage.php';
629  include_once './Services/User/classes/class.ilObjUser.php';
630  include_once "Services/Mail/classes/class.ilFormatMail.php";
631  include_once './Services/Registration/classes/class.ilRegistrationMailNotification.php';
632 
633  // Always send mail to approvers
634  if ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE && !$this->code_was_used) {
635  $mail = new ilRegistrationMailNotification();
637  $mail->setRecipients($this->registration_settings->getApproveRecipients());
638  $mail->setAdditionalInformation(array('usr' => $this->userObj));
639  $mail->send();
640  } else {
641  $mail = new ilRegistrationMailNotification();
643  $mail->setRecipients($this->registration_settings->getApproveRecipients());
644  $mail->setAdditionalInformation(array('usr' => $this->userObj));
645  $mail->send();
646  }
647 
648  // Send mail to new user
649  // Registration with confirmation link ist enabled
650  if ($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION && !$this->code_was_used) {
651  include_once './Services/Registration/classes/class.ilRegistrationMimeMailNotification.php';
652 
655  $mail->setRecipients(array($this->userObj));
656  $mail->setAdditionalInformation(
657  array(
658  'usr' => $this->userObj,
659  'hash_lifetime' => $this->registration_settings->getRegistrationHashLifetime()
660  )
661  );
662  $mail->send();
663  } else {
664  $accountMail = new ilAccountRegistrationMail(
665  $this->registration_settings,
666  $this->lng,
668  );
669  $accountMail->withDirectRegistrationMode()->send($this->userObj, $password, $this->code_was_used);
670  }
671  }
672 
676  public function login($password)
677  {
681  global $lng;
682 
683  ilStartUpGUI::initStartUpTemplate(array('tpl.usr_registered.html', 'Services/Registration'), false);
684  $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('registration'));
685 
686  $this->tpl->setVariable("TXT_WELCOME", $lng->txt("welcome") . ", " . $this->userObj->getTitle() . "!");
687  if (
688  (
689  $this->registration_settings->getRegistrationType() == IL_REG_DIRECT ||
690  $this->registration_settings->getRegistrationType() == IL_REG_CODES ||
692  ) &&
693  !$this->registration_settings->passwordGenerationEnabled()
694  ) {
695  // store authenticated user in session
696  ilSession::set('registered_user', $this->userObj->getId());
697 
698  $this->tpl->setCurrentBlock('activation');
699  $this->tpl->setVariable('TXT_REGISTERED', $lng->txt('txt_registered'));
700 
701  $action = $GLOBALS['DIC']->ctrl()->getFormAction($this, 'login') . '&target=' . ilUtil::stripSlashes($_GET['target']);
702  $this->tpl->setVariable('FORMACTION', $action);
703 
704  $this->tpl->setVariable('TXT_LOGIN', $lng->txt('login_to_ilias'));
705  $this->tpl->parseCurrentBlock();
706  } elseif ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE) {
707  $this->tpl->setVariable('TXT_REGISTERED', $lng->txt('txt_submitted'));
708  } elseif ($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION) {
709  $login_url = './login.php?cmd=force_login&lang=' . $this->userObj->getLanguage();
710  $this->tpl->setVariable('TXT_REGISTERED', sprintf($lng->txt('reg_confirmation_link_successful'), $login_url));
711  $this->tpl->setVariable('REDIRECT_URL', $login_url);
712  } else {
713  $this->tpl->setVariable('TXT_REGISTERED', $lng->txt('txt_registered_passw_gen'));
714  }
715  }
716 
722  protected function showLogin()
723  {
727  $auth_session = $GLOBALS['DIC']['ilAuthSession'];
728  $auth_session->setAuthenticated(
729  true,
730  ilSession::get('registered_user')
731  );
732  ilInitialisation::initUserAccount();
733  return ilInitialisation::redirectToStartingPage();
734  }
735 
736  protected function doProfileAutoComplete()
737  {
738  $field_id = (string) $_REQUEST["f"];
739  $term = (string) $_REQUEST["term"];
740 
741  include_once "Services/User/classes/class.ilPublicUserProfileGUI.php";
743  if (sizeof($result)) {
744  include_once 'Services/JSON/classes/class.ilJsonUtil.php';
746  }
747 
748  exit();
749  }
750 }
const UDF_TYPE_SELECT
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:193
global $ilErr
Definition: raiseError.php:16
Add rich text string
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
Class for mime mail registration notifications.
static _getInstance()
Get instance.
This class represents a selection list property in a property form.
$result
This class represents a property form user interface.
$action
Class ilAccountRegistrationGUI.
This class represents a captcha input in a property form.
$_GET["client_id"]
$tpl
Definition: ilias.php:10
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
static getInstance()
Get instance.
This class represents a section header in a property form.
$code
Definition: example_050.php:99
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getAutocompleteResult($a_field_id, $a_term)
static get($a_var)
Get a value.
Class ilUserProfile.
static set($a_var, $a_val)
Set a value.
This class represents a checkbox property in a property form.
static generatePasswords($a_number)
Generate a number of passwords.
static _getAllReferences($a_id)
get all reference ids of object
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
$password
Definition: pwgen.php:17
static encode($mixed, $suppress_native=false)
Class ilAccountRegistrationMail.
static isValidRegistrationCode($a_code)
Check if given code is a valid registration code.
const UDF_TYPE_TEXT
const IL_REG_ACTIVATION
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const UDF_TYPE_WYSIWYG
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static trackAcceptance(ilObjUser $user, ilTermsOfServiceSignableDocument $document)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a custom property in a property form.
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user&#39;s personal desktop
static isLogin($a_login)
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
This class represents a text area property in a property form.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
static _lookupAllowRegister($a_role_id)
check whether role is allowed in user registration or not
$_POST["username"]
setRequired($a_required)
Set Required.
static _doesLoginnameExistInHistory($a_login)
Checks wether the passed loginname already exists in history.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20