ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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/User/classes/class.ilUserAgreement.php";
20 
22 {
23  protected $registration_settings; // [object]
24  protected $code_enabled; // [bool]
25  protected $code_was_used; // [bool]
26 
27  public function __construct()
28  {
29  global $ilCtrl,$tpl,$lng;
30 
31  $this->tpl =& $tpl;
32 
33  $this->ctrl =& $ilCtrl;
34  $this->ctrl->saveParameter($this,'lang');
35 
36  $this->lng =& $lng;
37  $this->lng->loadLanguageModule('registration');
38 
39  $this->registration_settings = new ilRegistrationSettings();
40 
41  $this->code_enabled = ($this->registration_settings->registrationCodeRequired() ||
42  $this->registration_settings->getAllowCodes());
43  }
44 
45  public function executeCommand()
46  {
47  global $ilErr, $tpl;
48 
49  if($this->registration_settings->getRegistrationType() == IL_REG_DISABLED)
50  {
51  $ilErr->raiseError($this->lng->txt('reg_disabled'),$ilErr->FATAL);
52  }
53 
54  $next_class = $this->ctrl->getNextClass($this);
55  $cmd = $this->ctrl->getCmd();
56 
57  switch($next_class)
58  {
59  default:
60  if($cmd)
61  {
62  $this->$cmd();
63  }
64  else
65  {
66  $this->displayForm();
67  }
68  break;
69  }
70  $tpl->show();
71  return true;
72  }
73 
74  public function displayForm()
75  {
76  global $lng;
77 
78  $this->tpl->addBlockFile("CONTENT", "content", "tpl.startup_screen.html", "Services/Init");
79  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
80  $this->tpl->addBlockFile("STARTUP_CONTENT", "startup_content", "tpl.usr_registration.html",
81  "Services/Registration");
82  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
83 
84  $this->tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("registration"));
85 
86  $lang_opts = array();
87  foreach ($lng->getInstalledLanguages() as $lang_key)
88  {
89  $lang_opts[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key);
90  }
91 
92  // #11237
93  if(sizeof($lang_opts) > 1)
94  {
95  // language selection
96  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
97  $this->tpl->setVariable("TXT_OK",$lng->txt("ok"));
98  $this->tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
99 
100  asort($lang_opts);
101 
102  $this->tpl->setCurrentBlock("languages");
103  foreach($lang_opts as $lang_key => $lang_caption)
104  {
105  $this->tpl->setVariable("LANG_NAME", $lang_caption);
106  $this->tpl->setVariable("LANG_ICON", $lang_key);
107 
108  if($lang_key == $lng->getLangKey())
109  {
110  $this->tpl->setVariable("SELECTED_LANG", " selected=\"selected\"");
111  }
112 
113  $this->tpl->parseCurrentBlock();
114  }
115  }
116 
117  if(!$this->form)
118  {
119  $this->__initForm();
120  }
121  $this->tpl->setVariable("FORM", $this->form->getHTML());
122  }
123 
124  protected function __initForm()
125  {
126  global $lng, $ilUser;
127 
128  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
129  $this->form = new ilPropertyFormGUI();
130  $this->form->setFormAction($this->ctrl->getFormAction($this));
131 
132 
133  // code handling
134 
135  if($this->code_enabled)
136  {
137  include_once 'Services/Registration/classes/class.ilRegistrationCode.php';
138  $code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code");
139  $code->setSize(40);
140  $code->setMaxLength(ilRegistrationCode::CODE_LENGTH);
141  if((bool)$this->registration_settings->registrationCodeRequired())
142  {
143  $code->setRequired(true);
144  $code->setInfo($lng->txt("registration_code_required_info"));
145  }
146  else
147  {
148  $code->setInfo($lng->txt("registration_code_optional_info"));
149  }
150  $this->form->addItem($code);
151  }
152 
153 
154  // user defined fields
155 
156  $user_defined_data = $ilUser->getUserDefinedData();
157 
158  include_once './Services/User/classes/class.ilUserDefinedFields.php';
159  $user_defined_fields =& ilUserDefinedFields::_getInstance();
160  $custom_fields = array();
161  foreach($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition)
162  {
163  if($definition['field_type'] == UDF_TYPE_TEXT)
164  {
165  $custom_fields["udf_".$definition['field_id']] =
166  new ilTextInputGUI($definition['field_name'], "udf_".$definition['field_id']);
167  $custom_fields["udf_".$definition['field_id']]->setValue($user_defined_data["f_".$field_id]);
168  $custom_fields["udf_".$definition['field_id']]->setMaxLength(255);
169  $custom_fields["udf_".$definition['field_id']]->setSize(40);
170  }
171  else if($definition['field_type'] == UDF_TYPE_WYSIWYG)
172  {
173  $custom_fields["udf_".$definition['field_id']] =
174  new ilTextAreaInputGUI($definition['field_name'], "udf_".$definition['field_id']);
175  $custom_fields["udf_".$definition['field_id']]->setValue($user_defined_data["f_".$field_id]);
176  $custom_fields["udf_".$definition['field_id']]->setUseRte(true);
177  }
178  else
179  {
180  $custom_fields["udf_".$definition['field_id']] =
181  new ilSelectInputGUI($definition['field_name'], "udf_".$definition['field_id']);
182  $custom_fields["udf_".$definition['field_id']]->setValue($user_defined_data["f_".$field_id]);
183  $custom_fields["udf_".$definition['field_id']]->setOptions(
184  $user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
185  }
186  if($definition['required'])
187  {
188  $custom_fields["udf_".$definition['field_id']]->setRequired(true);
189  }
190  }
191 
192  // standard fields
193  include_once("./Services/User/classes/class.ilUserProfile.php");
194  $up = new ilUserProfile();
195  $up->setMode(ilUserProfile::MODE_REGISTRATION);
196  $up->skipGroup("preferences");
197 
198  // add fields to form
199  $up->addStandardFieldsToForm($this->form, NULL, $custom_fields);
200  unset($custom_fields);
201 
202 
203  // set language selection to current display language
204  $flang = $this->form->getItemByPostVar("usr_language");
205  if($flang)
206  {
207  $flang->setValue($lng->getLangKey());
208  }
209 
210  // add information to role selection (if not hidden)
211  if($this->code_enabled)
212  {
213  $role = $this->form->getItemByPostVar("usr_roles");
214  if($role && $role->getType() == "select")
215  {
216  $role->setInfo($lng->txt("registration_code_role_info"));
217  }
218  }
219 
220  // #14272
221  if($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION)
222  {
223  $mail_obj = $this->form->getItemByPostVar('usr_email');
224  $mail_obj->setRequired(true);
225  }
226 
227 
228  // user agreement
229 
230  $field = new ilFormSectionHeaderGUI();
231  $field->setTitle($lng->txt("usr_agreement"));
232  $this->form->addItem($field);
233 
234  $field = new ilCustomInputGUI();
235  $field->setHTML('<div id="agreement">'.ilUserAgreement::_getText().'</div>');
236  $this->form->addItem($field);
237 
238  $field = new ilCheckboxInputGUI($lng->txt("accept_usr_agreement"), "usr_agreement");
239  $field->setRequired(true);
240  $field->setValue(1);
241  $this->form->addItem($field);
242 
243 
244  $this->form->addCommandButton("saveForm", $lng->txt("register"));
245  }
246 
247  public function saveForm()
248  {
249  global $lng, $ilSetting;
250 
251  $this->__initForm();
252  $form_valid = $this->form->checkInput();
253 
254  require_once 'Services/User/classes/class.ilObjUser.php';
255 
256 
257  // custom validation
258 
259  // validate email against restricted domains
260  $email = $this->form->getInput("usr_email");
261  if($email)
262  {
263  // #10366
264  $domains = array();
265  foreach($this->registration_settings->getAllowedDomains() as $item)
266  {
267  if(trim($item))
268  {
269  $domains[] = $item;
270  }
271  }
272  if(sizeof($domains))
273  {
274  $mail_valid = false;
275  foreach($domains as $domain)
276  {
277  $domain = str_replace("*", "~~~", $domain);
278  $domain = preg_quote($domain);
279  $domain = str_replace("~~~", ".+", $domain);
280  if(preg_match("/^".$domain."$/", $email, $hit))
281  {
282  $mail_valid = true;
283  break;
284  }
285  }
286  if(!$mail_valid)
287  {
288  $mail_obj = $this->form->getItemByPostVar('usr_email');
289  $mail_obj->setAlert(sprintf($lng->txt("reg_email_domains"),
290  implode(", ", $domains)));
291  $form_valid = false;
292  }
293  }
294  }
295 
296  if(!$this->form->getInput("usr_agreement"))
297  {
298  $agr_obj = $this->form->getItemByPostVar('usr_agreement');
299  $agr_obj->setAlert($lng->txt("force_accept_usr_agreement"));
300  $form_valid = false;
301  }
302 
303  $valid_role = false;
304 
305  // code
306  if($this->code_enabled)
307  {
308  $code = $this->form->getInput('usr_registration_code');
309  // could be optional
310  if($code)
311  {
312  // code validation
313  include_once './Services/Registration/classes/class.ilRegistrationCode.php';
315  {
316  $code_obj = $this->form->getItemByPostVar('usr_registration_code');
317  $code_obj->setAlert($lng->txt('registration_code_not_valid'));
318  $form_valid = false;
319  }
320  else
321  {
322  // get role from valid code
323  $valid_role = (int)ilRegistrationCode::getCodeRole($code);
324  }
325  }
326  }
327 
328  // no need if role is attached to code
329  if(!$valid_role)
330  {
331  // manual selection
332  if ($this->registration_settings->roleSelectionEnabled())
333  {
334  include_once "./Services/AccessControl/classes/class.ilObjRole.php";
335  $selected_role = $this->form->getInput("usr_roles");
336  if ($selected_role && ilObjRole::_lookupAllowRegister($selected_role))
337  {
338  $valid_role = (int)$selected_role;
339  }
340  }
341  // assign by email
342  else
343  {
344  include_once 'Services/Registration/classes/class.ilRegistrationEmailRoleAssignments.php';
345  $registration_role_assignments = new ilRegistrationRoleAssignments();
346  $valid_role = (int)$registration_role_assignments->getRoleByEmail($this->form->getInput("usr_email"));
347  }
348  }
349 
350  // no valid role could be determined
351  if (!$valid_role)
352  {
353  ilUtil::sendInfo($lng->txt("registration_no_valid_role"));
354  $form_valid = false;
355  }
356 
357  // validate username
358  $login_obj = $this->form->getItemByPostVar('username');
359  $login = $this->form->getInput("username");
360  if (!ilUtil::isLogin($login))
361  {
362  $login_obj->setAlert($lng->txt("login_invalid"));
363  $form_valid = false;
364  }
365  else if (ilObjUser::_loginExists($login))
366  {
367  $login_obj->setAlert($lng->txt("login_exists"));
368  $form_valid = false;
369  }
370  else if ((int)$ilSetting->get('allow_change_loginname') &&
371  (int)$ilSetting->get('reuse_of_loginnames') == 0 &&
373  {
374  $login_obj->setAlert($lng->txt('login_exists'));
375  $form_valid = false;
376  }
377 
378  if(!$form_valid)
379  {
380  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
381  }
382  else
383  {
384  $password = $this->__createUser($valid_role);
385  $this->__distributeMails($password, $this->form->getInput("usr_language"));
386  $this->login($password);
387  return true;
388  }
389 
390  $this->form->setValuesByPost();
391  $this->displayForm();
392  return false;
393  }
394 
395  protected function __createUser($a_role)
396  {
397  global $ilSetting, $rbacadmin;
398 
399  $this->userObj = new ilObjUser();
400 
401  include_once("./Services/User/classes/class.ilUserProfile.php");
402  $up = new ilUserProfile();
403  $up->setMode(ilUserProfile::MODE_REGISTRATION);
404 
405  $map = array();
406  $up->skipGroup("preferences");
407  $up->skipGroup("settings");
408  $up->skipGroup("instant_messengers");
409  $up->skipField("password");
410  $up->skipField("birthday");
411  $up->skipField("upload");
412  foreach ($up->getStandardFields() as $k => $v)
413  {
414  if($v["method"])
415  {
416  $method = "set".substr($v["method"], 3);
417  if(method_exists($this->userObj, $method))
418  {
419  if ($k != "username")
420  {
421  $k = "usr_".$k;
422  }
423  $field_obj = $this->form->getItemByPostVar($k);
424  if($field_obj)
425  {
426 
427  $this->userObj->$method($this->form->getInput($k));
428  }
429  }
430  }
431  }
432 
433  $this->userObj->setFullName();
434 
435  $birthday_obj = $this->form->getItemByPostVar("usr_birthday");
436  if ($birthday_obj)
437  {
438  $birthday = $this->form->getInput("usr_birthday");
439  $birthday = $birthday["date"];
440 
441  // when birthday was not set, array will not be substituted with string by ilBirthdayInputGui
442  if(!is_array($birthday))
443  {
444  $this->userObj->setBirthday($birthday);
445  }
446  }
447 
448  // messenger
449  $map = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
450  foreach($map as $client)
451  {
452  $field = "usr_im_".$client;
453  $field_obj = $this->form->getItemByPostVar($field);
454  if($field_obj)
455  {
456  $this->userObj->setInstantMessengerId($client, $this->form->getInput($field));
457  }
458  }
459 
460  $this->userObj->setTitle($this->userObj->getFullname());
461  $this->userObj->setDescription($this->userObj->getEmail());
462 
463  if ($this->registration_settings->passwordGenerationEnabled())
464  {
465  $password = ilUtil::generatePasswords(1);
466  $password = $password[0];
467  }
468  else
469  {
470  $password = $this->form->getInput("usr_password");
471  }
472  $this->userObj->setPasswd($password);
473 
474 
475  // Set user defined data
476  include_once './Services/User/classes/class.ilUserDefinedFields.php';
477  $user_defined_fields =& ilUserDefinedFields::_getInstance();
478  $defs = $user_defined_fields->getRegistrationDefinitions();
479  $udf = array();
480  foreach ($_POST as $k => $v)
481  {
482  if (substr($k, 0, 4) == "udf_")
483  {
484  $f = substr($k, 4);
485  $udf[$f] = $v;
486  }
487  }
488  $this->userObj->setUserDefinedData($udf);
489 
490  $this->userObj->setTimeLimitOwner(7);
491 
492  $this->code_was_used = false;
493  if($this->code_enabled)
494  {
495  // #10853 - could be optional
496  $code = $this->form->getInput('usr_registration_code');
497  if($code)
498  {
499  // set code to used
500  include_once './Services/Registration/classes/class.ilRegistrationCode.php';
502  $this->code_was_used = true;
503  }
504  }
505 
506  // something went wrong with the form validation
507  if(!$a_role)
508  {
509  global $ilias;
510  $ilias->raiseError("Invalid role selection in registration".
511  ", IP: ".$_SERVER["REMOTE_ADDR"], $ilias->error_obj->FATAL);
512  }
513 
514  if ($this->registration_settings->getAccessLimitation())
515  {
516  include_once 'Services/Registration/classes/class.ilRegistrationRoleAccessLimitations.php';
517  $access_limitations_obj = new ilRegistrationRoleAccessLimitations();
518 
519  $access_limit_mode = $access_limitations_obj->getMode($a_role);
520  if ($access_limit_mode == 'absolute')
521  {
522  $access_limit = $access_limitations_obj->getAbsolute($a_role);
523  $this->userObj->setTimeLimitUnlimited(0);
524  $this->userObj->setTimeLimitUntil($access_limit);
525  }
526  elseif ($access_limit_mode == 'relative')
527  {
528  $rel_d = (int) $access_limitations_obj->getRelative($a_role,'d');
529  $rel_m = (int) $access_limitations_obj->getRelative($a_role,'m');
530  $rel_y = (int) $access_limitations_obj->getRelative($a_role,'y');
531 
532  $access_limit = $rel_d * 86400 + $rel_m * 2592000 + $rel_y * 31536000 + time();
533  $this->userObj->setTimeLimitUnlimited(0);
534  $this->userObj->setTimeLimitUntil($access_limit);
535  }
536  else
537  {
538  $this->userObj->setTimeLimitUnlimited(1);
539  $this->userObj->setTimeLimitUntil(time());
540  }
541  }
542  else
543  {
544  $this->userObj->setTimeLimitUnlimited(1);
545  $this->userObj->setTimeLimitUntil(time());
546  }
547 
548  $this->userObj->setTimeLimitFrom(time());
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  {
557  $this->userObj->setActive(1,0);
558  }
559  else if($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION)
560  {
561  $this->userObj->setActive(0,0);
562  }
563  else
564  {
565  $this->userObj->setActive(0,0);
566  }
567 
568  $this->userObj->updateOwner();
569 
570  // set a timestamp for last_password_change
571  // this ts is needed by the ACCOUNT_SECURITY_MODE_CUSTOMIZED
572  // in ilSecuritySettings
573  $this->userObj->setLastPasswordChangeTS( time() );
574 
575  $this->userObj->setIsSelfRegistered(true);
576 
577  //insert user data in table user_data
578  $this->userObj->saveAsNew();
579 
580  // store acceptance of user agreement
581  $this->userObj->writeAccepted();
582 
583  // setup user preferences
584  $this->userObj->setLanguage($this->form->getInput('usr_language'));
585  $hits_per_page = $ilSetting->get("hits_per_page");
586  if ($hits_per_page < 10)
587  {
588  $hits_per_page = 10;
589  }
590  $this->userObj->setPref("hits_per_page", $hits_per_page);
591  $show_online = $ilSetting->get("show_users_online");
592  if ($show_online == "")
593  {
594  $show_online = "y";
595  }
596  $this->userObj->setPref("show_users_online", $show_online);
597  $this->userObj->writePrefs();
598 
599  $rbacadmin->assignUser((int)$a_role, $this->userObj->getId(), true);
600 
601  return $password;
602  }
603 
604  protected function __distributeMails($password, $a_language = null)
605  {
606  global $ilSetting;
607 
608  include_once './Services/Language/classes/class.ilLanguage.php';
609  include_once './Services/User/classes/class.ilObjUser.php';
610  include_once "Services/Mail/classes/class.ilFormatMail.php";
611  include_once './Services/Registration/classes/class.ilRegistrationMailNotification.php';
612 
613  // Always send mail to approvers
614  if($this->registration_settings->getRegistrationType() == IL_REG_APPROVE && !$this->code_was_used)
615  {
616  $mail = new ilRegistrationMailNotification();
618  $mail->setRecipients($this->registration_settings->getApproveRecipients());
619  $mail->setAdditionalInformation(array('usr' => $this->userObj));
620  $mail->send();
621  }
622  else
623  {
624  $mail = new ilRegistrationMailNotification();
626  $mail->setRecipients($this->registration_settings->getApproveRecipients());
627  $mail->setAdditionalInformation(array('usr' => $this->userObj));
628  $mail->send();
629 
630  }
631  // Send mail to new user
632 
633  // Registration with confirmation link ist enabled
634  if($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION && !$this->code_was_used)
635  {
636  include_once './Services/Registration/classes/class.ilRegistrationMimeMailNotification.php';
637 
640  $mail->setRecipients(array($this->userObj));
641  $mail->setAdditionalInformation(
642  array(
643  'usr' => $this->userObj,
644  'hash_lifetime' => $this->registration_settings->getRegistrationHashLifetime()
645  )
646  );
647  $mail->send();
648  }
649  else
650  {
651  // try individual account mail in user administration
652  include_once("Services/Mail/classes/class.ilAccountMail.php");
653  include_once './Services/User/classes/class.ilObjUserFolder.php';
654 
655  $amail = ilObjUserFolder::_lookupNewAccountMail($a_language);
656  if (trim($amail["body"]) == "" || trim($amail["subject"]) == "")
657  {
658  $amail = ilObjUserFolder::_lookupNewAccountMail($GLOBALS["lng"]->getDefaultLanguage());
659  }
660  if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
661  {
662  $acc_mail = new ilAccountMail();
663  $acc_mail->setUser($this->userObj);
664  if ($this->registration_settings->passwordGenerationEnabled())
665  {
666  $acc_mail->setUserPassword($password);
667  }
668 
669  if($amail["att_file"])
670  {
671  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
673  $fs->create();
674  $path = $fs->getAbsolutePath()."/";
675 
676  $acc_mail->addAttachment($path."/".$amail["lang"], $amail["att_file"]);
677  }
678 
679  $acc_mail->send();
680  }
681  else // do default mail
682  {
683  include_once "Services/Mail/classes/class.ilMimeMail.php";
684 
685  $mmail = new ilMimeMail();
686  $mmail->autoCheck(false);
687  $mmail->From($ilSetting->get("admin_email"));
688  $mmail->To($this->userObj->getEmail());
689 
690  // mail subject
691  $subject = $this->lng->txt("reg_mail_subject");
692 
693  // mail body
694  $body = $this->lng->txt("reg_mail_body_salutation")." ".$this->userObj->getFullname().",\n\n".
695  $this->lng->txt("reg_mail_body_text1")."\n\n".
696  $this->lng->txt("reg_mail_body_text2")."\n".
697  ILIAS_HTTP_PATH."/login.php?client_id=".CLIENT_ID."\n";
698  $body .= $this->lng->txt("login").": ".$this->userObj->getLogin()."\n";
699 
700  if ($this->registration_settings->passwordGenerationEnabled())
701  {
702  $body.= $this->lng->txt("passwd").": ".$password."\n";
703  }
704  $body.= "\n";
705 
706  // Info about necessary approvement
707  if($this->registration_settings->getRegistrationType() == IL_REG_APPROVE && !$this->code_was_used)
708  {
709  $body .= ($this->lng->txt('reg_mail_body_pwd_generation')."\n\n");
710  }
711 
712  $body .= ($this->lng->txt("reg_mail_body_text3")."\n\r");
713  $body .= $this->userObj->getProfileAsString($this->lng);
714  $mmail->Subject($subject);
715  $mmail->Body($body);
716  $mmail->Send();
717  }
718  }
719  }
720 
721  public function login($password)
722  {
723  global $ilias,$lng,$ilLog;
724 
725  $ilLog->write("Entered login");
726 
727  $this->tpl->addBlockFile("CONTENT", "content", "tpl.startup_screen.html", "Services/Init");
728  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
729  $this->tpl->addBlockFile("STARTUP_CONTENT", "startup_content", "tpl.usr_registered.html",
730  "Services/Registration");
731 
732  $this->tpl->setVariable("IMG_USER",
733  ilUtil::getImagePath("icon_usr_b.png"));
734  $this->tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("registration"));
735  $this->tpl->setVariable("TXT_WELCOME", $lng->txt("welcome").", ".$this->userObj->getTitle()."!");
736 
737  if (($this->registration_settings->getRegistrationType() == IL_REG_DIRECT or
738  $this->registration_settings->getRegistrationType() == IL_REG_CODES or
740  !$this->registration_settings->passwordGenerationEnabled())
741  {
742  $this->tpl->setCurrentBlock("activation");
743  $this->tpl->setVariable("TXT_REGISTERED", $lng->txt("txt_registered"));
744  $this->tpl->setVariable("FORMACTION", "login.php?cmd=post&target=".$_GET["target"]);
745  if(isset($_SESSION['forceShoppingCartRedirect']))
746  {
747  $this->tpl->setVariable("FORMACTION", './login.php?forceShoppingCartRedirect=1');
748  }
749  $this->tpl->setVariable("TARGET","target=\"_parent\"");
750  $this->tpl->setVariable("TXT_LOGIN", $lng->txt("login_to_ilias"));
751  $this->tpl->setVariable("USERNAME",$this->userObj->getLogin());
752  $this->tpl->setVariable("PASSWORD",$password);
753  $this->tpl->parseCurrentBlock();
754  }
755  else if ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE)
756  {
757  $this->tpl->setVariable("TXT_REGISTERED", $lng->txt("txt_submitted"));
758  }
759  else if($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION)
760  {
761  $login_url = './login.php?cmd=force_login&lang='.$this->userObj->getLanguage();
762  $this->tpl->setVariable("TXT_REGISTERED", sprintf($lng->txt("reg_confirmation_link_successful"), $login_url));
763  $this->tpl->setVariable("REDIRECT_URL", $login_url);
764  }
765  else
766  {
767  $this->tpl->setVariable("TXT_REGISTERED", $lng->txt("txt_registered_passw_gen"));
768  }
769  }
770 }
771 ?>