ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilStartUpGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
14 {
15 
19  function ilStartUpGUI()
20  {
21  global $ilCtrl;
22 
23  $this->ctrl =& $ilCtrl;
24 
25  $ilCtrl->saveParameter($this, array("rep_ref_id", "lang", "target", "client_id"));
26  }
27 
31  function &executeCommand()
32  {
33  $cmd = $this->ctrl->getCmd("processIndexPHP");
34  $next_class = $this->ctrl->getNextClass($this);
35 
36  switch($next_class)
37  {
38  case "ilaccountregistrationgui":
39  require_once("Services/Registration/classes/class.ilAccountRegistrationGUI.php");
40  return $this->ctrl->forwardCommand(new ilAccountRegistrationGUI());
41  break;
42 
43  case "ilpasswordassistancegui":
44  require_once("Services/Init/classes/class.ilPasswordAssistanceGUI.php");
45  return $this->ctrl->forwardCommand(new ilPasswordAssistanceGUI());
46  break;
47 
48  default:
49  $r = $this->$cmd();
50  return $r;
51  break;
52  }
53  }
54 
58  function jumpToRegistration()
59  {
60  $this->ctrl->setCmdClass("ilaccountregistrationgui");
61  $this->ctrl->setCmd("");
62  $this->executeCommand();
63  }
64 
69  {
70  $this->ctrl->setCmdClass("ilpasswordassistancegui");
71  $this->ctrl->setCmd("");
72  $this->executeCommand();
73  }
74 
78  function showLogin()
79  {
80  global $ilSetting, $ilAuth, $ilUser, $tpl, $ilIliasIniFile, $ilias, $lng;
81 
82  // if authentication of soap user failed, but email address is
83  // known, show users and ask for password
84  $status = $ilAuth->getStatus();
85  if ($status == "" && isset($_GET["auth_stat"]))
86  {
87  $status = $_GET["auth_stat"];
88  }
89  if ($status == AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL)
90  {
91  $this->showUserMappingSelection();
92  return;
93  }
94 
95  // login language selection is post type
96  if (isset($_POST["lang"]) && $_POST["lang"] != "")
97  {
98  $_GET["lang"] = ilUtil::stripSlashes($_POST["lang"]);
99  }
100 
101  // check for session cookies enabled
102  if (!isset($_COOKIE['iltest']))
103  {
104  if (empty($_GET['cookies']))
105  {
106  $additional_params = '';
107  if((int)$_GET['forceShoppingCartRedirect'])# && (int)$_SESSION['price_id'] && (int)$_SESSION['pobject_id'])
108  {
109  $additional_params .= '&login_to_purchase_object=1&forceShoppingCartRedirect=1';
110  }
111 
112  ilUtil::setCookie("iltest","cookie",false);
113  //header('Location: '.$_SERVER['PHP_SELF']."?target=".$_GET["target"]."&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"]."&cookies=nocookies&client_id=".$_GET['client_id']."&lang=".$_GET['lang']);
114  header("Location: login.php?target=".$_GET["target"]."&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"]."&cookies=nocookies&client_id=".rawurlencode(CLIENT_ID)."&lang=".$_GET['lang'].$additional_params);
115  }
116  else
117  {
118  $_COOKIE['iltest'] = "";
119  }
120  }
121  else
122  {
123  unset($_GET['cookies']);
124  }
125 
126  // check correct setup
127  if (!$ilSetting->get("setup_ok"))
128  {
129  die("Setup is not completed. Please run setup routine again. (Login)");
130  }
131 
132  if ($ilSetting->get("shib_active") && $ilSetting->get("shib_hos_type"))
133  {
134  require_once "./Services/AuthShibboleth/classes/class.ilShibbolethWAYF.php";
135  // Check if we user selects Home Organization
136  $WAYF = new ShibWAYF();
137  }
138 
139  if (isset($WAYF) && $WAYF->isSelection())
140  {
141  if ($WAYF->isValidSelection())
142  {
143  // Set cookie
144  $WAYF->setSAMLCookie();
145 
146  // Redirect
147  $WAYF->redirect();
148  }
149  }
150  elseif ($ilAuth->getAuth())
151  {
152  // Or we do authentication here
153  // To do: check whether some $ilInit method could be used here.
154 
155  if(!$ilUser->checkTimeLimit())
156  {
157  $ilAuth->logout();
158  session_destroy();
159 
160  // to do: get rid of this
161  ilUtil::redirect('login.php?time_limit=true');
162  }
163 
164  include_once './Services/Tracking/classes/class.ilOnlineTracking.php';
165  ilOnlineTracking::_addUser($ilUser->getId());
166 
167  if ($_GET["rep_ref_id"] != "")
168  {
169  $_GET["ref_id"] = $_GET["rep_ref_id"];
170  }
171  $this->processStartingPage();
172  exit;
173  }
174 
175  // Instantiate login template
176  // Use Shibboleth-only authentication if auth_mode is set to Shibboleth
177  $tpl->addBlockFile("CONTENT", "content", "tpl.login.html",
178  "Services/Init");
179 
180  //language handling
181  if ($_GET["lang"] == "")
182  {
183  $_GET["lang"] = $ilIliasIniFile->readVariable("language","default");
184  }
185 
186  //instantiate language
187  $lng = new ilLanguage($_GET["lang"]);
188 
189  $tpl->setVariable("PAGETITLE", $lng->txt("startpage"));
190  $tpl->setVariable("TXT_OK", $lng->txt("ok"));
191 
192  $languages = $lng->getInstalledLanguages();
193 
194  foreach ($languages as $lang_key)
195  {
196  $tpl->setCurrentBlock("languages");
197  $tpl->setVariable("LANG_KEY", $lang_key);
198  $tpl->setVariable("LANG_NAME",
199  ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
200  $tpl->setVariable("BORDER", 0);
201  $tpl->setVariable("VSPACE", 0);
202  $tpl->parseCurrentBlock();
203  }
204 
205  // allow new registrations?
206  include_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
208  {
209  $tpl->setCurrentBlock("new_registration");
210  $tpl->setVariable("REGISTER", $lng->txt("registration"));
211  $tpl->setVariable("CMD_REGISTER",
212  $this->ctrl->getLinkTargetByClass("ilaccountregistrationgui", ""));
213  $tpl->parseCurrentBlock();
214  }
215  // allow password assistance? Surpress option if Authmode is not local database
216  if ($ilSetting->get("password_assistance"))
217  {
218  $tpl->setCurrentBlock("password_assistance");
219  $tpl->setVariable("FORGOT_PASSWORD", $lng->txt("forgot_password"));
220  $tpl->setVariable("FORGOT_USERNAME", $lng->txt("forgot_username"));
221  $tpl->setVariable("CMD_FORGOT_PASSWORD",
222  $this->ctrl->getLinkTargetByClass("ilpasswordassistancegui", ""));
223  $tpl->setVariable("CMD_FORGOT_USERNAME",
224  $this->ctrl->getLinkTargetByClass("ilpasswordassistancegui", "showUsernameAssistanceForm"));
225  $tpl->setVariable("LANG_ID", $_GET["lang"]);
226  $tpl->parseCurrentBlock();
227  }
228 
229  if ($ilSetting->get("pub_section"))
230  {
231  $tpl->setCurrentBlock("homelink");
232  $tpl->setVariable("CLIENT_ID","?client_id=".$_COOKIE["ilClientId"]."&lang=".$_GET["lang"]);
233  $tpl->setVariable("TXT_HOME",$lng->txt("home"));
234  $tpl->parseCurrentBlock();
235  }
236 
237  if ($ilIliasIniFile->readVariable("clients","list"))
238  {
239  $tpl->setCurrentBlock("client_list");
240  $tpl->setVariable("TXT_CLIENT_LIST", $lng->txt("to_client_list"));
241  $tpl->setVariable("CMD_CLIENT_LIST",
242  $this->ctrl->getLinkTarget($this, "showClientList"));
243  $tpl->parseCurrentBlock();
244  }
245 
246  // shibboleth login link
247  if ($ilSetting->get("shib_active"))
248  {
249 
250  if($ilSetting->get("shib_hos_type") == 'external_wayf'){
251  $tpl->setCurrentBlock("shibboleth_login");
252  $tpl->setVariable("TXT_SHIB_LOGIN", $lng->txt("login_to_ilias_via_shibboleth"));
253  $tpl->setVariable("IL_TARGET", $_GET["target"]);
254  $tpl->setVariable("TXT_SHIB_FEDERATION_NAME", $ilSetting->get("shib_federation_name"));
255  $tpl->setVariable("TXT_SHIB_LOGIN_BUTTON", $ilSetting->get("shib_login_button"));
256  $tpl->setVariable("TXT_SHIB_LOGIN_INSTRUCTIONS", sprintf($lng->txt("shib_general_login_instructions"),$ilSetting->get("shib_federation_name")).' <a href="mailto:'.$ilias->getSetting("admin_email").'">ILIAS '. $lng->txt("administrator").'</a>.');
257  $tpl->setVariable("TXT_SHIB_CUSTOM_LOGIN_INSTRUCTIONS", $ilSetting->get("shib_login_instructions"));
258  $tpl->parseCurrentBlock();
259  } elseif($ilSetting->get("shib_hos_type") == 'embedded_wayf') {
260  $tpl->setCurrentBlock("shibboleth_custom_login");
261  $customInstructions = stripslashes( $ilSetting->get("shib_login_instructions"));
262  $tpl->setVariable("TXT_SHIB_CUSTOM_LOGIN_INSTRUCTIONS", $customInstructions);
263  $tpl->parseCurrentBlock();
264  } else {
265  $tpl->setCurrentBlock("shibboleth_wayf_login");
266  $tpl->setVariable("TXT_SHIB_LOGIN", $lng->txt("login_to_ilias_via_shibboleth"));
267  $tpl->setVariable("TXT_SHIB_FEDERATION_NAME", $ilSetting->get("shib_federation_name"));
268  $tpl->setVariable("TXT_SELECT_HOME_ORGANIZATION", sprintf($lng->txt("shib_select_home_organization"), $ilSetting->get("shib_federation_name")));
269  $tpl->setVariable("TXT_CONTINUE", $lng->txt("btn_next"));
270  $tpl->setVariable("TXT_SHIB_HOME_ORGANIZATION", $lng->txt("shib_home_organization"));
271  $tpl->setVariable("TXT_SHIB_LOGIN_INSTRUCTIONS", $lng->txt("shib_general_wayf_login_instructions").' <a href="mailto:'.$ilias->getSetting("admin_email").'">ILIAS '. $lng->txt("administrator").'</a>.');
272  $tpl->setVariable("TXT_SHIB_CUSTOM_LOGIN_INSTRUCTIONS", $ilSetting->get("shib_login_instructions"));
273  $tpl->setVariable("TXT_SHIB_INVALID_SELECTION", $WAYF->showNotice());
274  $tpl->setVariable("SHIB_IDP_LIST", $WAYF->generateSelection());
275  $tpl->setVariable("ILW_TARGET", $_GET["target"]);
276  $tpl->parseCurrentBlock();
277  }
278  }
279 
280  // cas login link
281  if ($ilSetting->get("cas_active"))
282  {
283  $tpl->setCurrentBlock("cas_login");
284  $tpl->setVariable("TXT_CAS_LOGIN", $lng->txt("login_to_ilias_via_cas"));
285  $tpl->setVariable("TXT_CAS_LOGIN_BUTTON", ilUtil::getImagePath("cas_login_button.gif"));
286  $tpl->setVariable("TXT_CAS_LOGIN_INSTRUCTIONS", $ilSetting->get("cas_login_instructions"));
287  $this->ctrl->setParameter($this, "forceCASLogin", "1");
288  $tpl->setVariable("TARGET_CAS_LOGIN",
289  $this->ctrl->getLinkTarget($this, "showLogin"));
290  $this->ctrl->setParameter($this, "forceCASLogin", "");
291  $tpl->parseCurrentBlock();
292  }
293 
294  // login via ILIAS (this also includes radius and ldap)
295  // If local authentication is enabled for shibboleth users, we
296  // display the login form for ILIAS here.
297  if (($ilSetting->get("auth_mode") != AUTH_SHIBBOLETH ||
298  $ilSetting->get("shib_auth_allow_local")) &&
299  $ilSetting->get("auth_mode") != AUTH_CAS)
300  {
301  $loginSettings = new ilSetting("login_settings");
302  if ($_GET["lang"] == false)
303  {
304  $information = $loginSettings->get("login_message_".$lng->getDefaultLanguage());
305  }
306  else
307  {
308  $information = $loginSettings->get("login_message_".$_GET["lang"]);
309  }
310 
311  if(strlen(trim($information)))
312  {
313  $tpl->setVariable("TXT_LOGIN_INFORMATION", $information);
314  }
315 
316  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
317  $form = new ilPropertyFormGUI();
318  $form->setOpenTag(false);
319  $form->setCloseTag(false);
320  $form->setTitle($lng->txt("login_to_ilias"));
321 
322  // auth selection
323  include_once('./Services/Authentication/classes/class.ilAuthModeDetermination.php');
325  if(ilAuthUtils::_hasMultipleAuthenticationMethods() and $det->isManualSelection())
326  {
327  $radg = new ilRadioGroupInputGUI($lng->txt("auth_selection"), "auth_mode");
328  foreach(ilAuthUtils::_getMultipleAuthModeOptions($lng) as $key => $option)
329  {
330  $op1 = new ilRadioOption($option['txt'], $key);
331  $radg->addOption($op1);
332  if (isset($option['checked']))
333  {
334  $radg->setValue($key);
335  }
336  }
337 
338  $form->addItem($radg);
339  }
340 
341  // username
342  $ti = new ilTextInputGUI($lng->txt("username"), "username");
343  $ti->setSize(20);
344  $form->addItem($ti);
345 
346  // password
347  $pi = new ilPasswordInputGUI($lng->txt("password"), "password");
348  $pi->setRetype(false);
349  $pi->setSize(20);
350  $form->addItem($pi);
351  $form->addCommandButton("butSubmit", $lng->txt("log_in"));
352  $tpl->setVariable("LOGIN_FORM", $form->getHTML());
353 
354  $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
355  $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
356  $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
357  if (isset($_POST["username"]))
358  {
359  $tpl->setVariable("USERNAME", ilUtil::prepareFormOutput($_POST["username"], true));
360  }
361  $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
362  $tpl->parseCurrentBlock();
363  }
364 
365  // Show openid login screen
366  $this->showOpenIdLogin();
367 
368  $tpl->setVariable("ILIAS_RELEASE", $ilSetting->get("ilias_version"));
369 
370  if (isset($_GET['forceShoppingCartRedirect']))
371  {
372  $this->ctrl->setParameter($this, 'forceShoppingCartRedirect', 1);
373  }
374 
375  $this->ctrl->setTargetScript("login.php");
376  $tpl->setVariable("FORMACTION",
377  $this->ctrl->getFormAction($this));
378 //echo "-".htmlentities($this->ctrl->getFormAction($this, "showLogin"))."-";
379  $tpl->setVariable("LANG_FORM_ACTION",
380  $this->ctrl->getFormAction($this));
381  $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
382  $tpl->setVariable("LANG_ID", $_GET["lang"]);
383 
384  if (isset($_GET['inactive']) && $_GET['inactive'])
385  {
386  $this->showFailure($lng->txt("err_inactive"));
387  }
388  else if (isset($_GET['expired']) && $_GET['expired'])
389  {
390  $this->showFailure($lng->txt("err_session_expired"));
391  }
392  else if (isset($_GET['login_to_purchase_object']) && $_GET['login_to_purchase_object'])
393  {
394  $lng->loadLanguageModule('payment');
395  $this->showFailure($lng->txt("payment_login_to_buy_object"));
396  }
397  else if (isset($_GET['reg_confirmation_msg']) && strlen(trim($_GET['reg_confirmation_msg'])))
398  {
399  $lng->loadLanguageModule('registration');
400  if($_GET['reg_confirmation_msg'] == 'reg_account_confirmation_successful')
401  $this->showSuccess($lng->txt(trim($_GET['reg_confirmation_msg'])));
402  else
403  $this->showFailure($lng->txt(trim($_GET['reg_confirmation_msg'])));
404  }
405  elseif(isset($_GET['reached_session_limit']) && $_GET['reached_session_limit'])
406  {
407  $this->showFailure($lng->txt("reached_session_limit"));
408  }
409 
410  // TODO: Move this to header.inc since an expired session could not detected in login script
411  $status = $ilAuth->getStatus();
412 
413  if ($status == "" && isset($_GET["auth_stat"]))
414  {
415  $status = $_GET["auth_stat"];
416  }
417  $auth_error = $ilias->getAuthError();
418 
419  if (!empty($status))
420  {
421  switch ($status)
422  {
423  case AUTH_EXPIRED:
424  $this->showFailure($lng->txt("err_session_expired"));
425  break;
426  case AUTH_IDLED:
427  // lang variable err_idled not existing
428  //$tpl->setVariable(TXT_MSG_LOGIN_FAILED, $lng->txt("err_idled"));
429  break;
430 
432  $this->showFailure($lng->txt("err_auth_cas_no_ilias_user"));
433  break;
434 
436  $this->showFailure($lng->txt("err_auth_soap_no_ilias_user"));
437  break;
438 
440  $this->showFailure($lng->txt("err_auth_ldap_no_ilias_user"));
441  break;
442 
444  $this->showFailure($lng->txt("err_auth_radius_no_ilias_user"));
445  break;
446 
447  case AUTH_MODE_INACTIVE:
448  $this->showFailure($lng->txt("err_auth_mode_inactive"));
449  break;
450 
451  case AUTH_APACHE_FAILED:
452  $this->showFailure($lng->txt("err_auth_apache_failed"));
453  break;
454 
455  case AUTH_WRONG_LOGIN:
456  default:
457  $add = "";
458  if (is_object($auth_error))
459  {
460  $add = "<br>".$auth_error->getMessage();
461  }
462  $this->showFailure($lng->txt("err_wrong_login").$add);
463  break;
464  }
465  }
466 
467 
468  if (isset($_GET['time_limit']) && $_GET['time_limit'])
469  {
470  $this->showFailure($lng->txt("time_limit_reached"));
471  }
472 
473  // output wrong IP message
474  if (isset($_GET['wrong_ip']) && $_GET['wrong_ip'])
475  {
476  $this->showFailure($lng->txt("wrong_ip_detected")." (".$_SERVER["REMOTE_ADDR"].")");
477  }
478 
479  // outout simultaneous login message
480  if (isset($_GET['simultaneous_login']) && $_GET['simultaneous_login'])
481  {
482  $this->showFailure($lng->txt("simultaneous_login_detected"));
483  }
484 
485  $this->ctrl->setTargetScript("ilias.php");
486  $tpl->setVariable("PHP_SELF", $_SERVER['PHP_SELF']);
487  $tpl->setVariable("USER_AGREEMENT", $lng->txt("usr_agreement"));
488  $tpl->setVariable("LINK_USER_AGREEMENT",
489  $this->ctrl->getLinkTarget($this, "showUserAgreement"));
490 
491  // browser does not accept cookies
492  if (isset($_GET['cookies']) && $_GET['cookies'] == 'nocookies')
493  {
494  $this->showFailure($lng->txt("err_no_cookies"));
495  $tpl->setVariable("COOKIES_HOWTO", $lng->txt("cookies_howto"));
496  $tpl->setVariable("LINK_NO_COOKIES",
497  $this->ctrl->getLinkTarget($this, "showNoCookiesScreen"));
498  }
499 
500  $tpl->show("DEFAULT", false);
501  }
502 
503  function showFailure($a_mess)
504  {
505  global $tpl, $lng;
506 
507  $tpl->setCurrentBlock("warning");
508  $tpl->setVariable('TXT_MSG_LOGIN_FAILED', $a_mess);
509  $tpl->setVariable("MESSAGE_HEADING", $lng->txt("failure_message"));
510  $tpl->setVariable("ALT_IMAGE", $lng->txt("icon")." ".$lng->txt("failure_message"));
511  $tpl->setVariable("SRC_IMAGE", ilUtil::getImagePath("mess_failure.gif"));
512  $tpl->parseCurrentBlock();
513  }
514 
515  public function showSuccess($a_mess)
516  {
517  global $tpl, $lng;
518 
519  $tpl->setCurrentBlock('success');
520  $tpl->setVariable('TXT_MSG_LOGIN_SUCCESS', $a_mess);
521  $tpl->setVariable('MESSAGE_HEADING', $lng->txt('success_message'));
522  $tpl->setVariable('ALT_IMAGE', $lng->txt('icon').' '.$lng->txt('success_message'));
523  $tpl->setVariable('SRC_IMAGE', ilUtil::getImagePath('mess_success.gif'));
524  $tpl->parseCurrentBlock();
525  }
526 
534  public function showAccountMigration($a_message = '')
535  {
536  global $tpl,$lng;
537 
538  $lng->loadLanguageModule('auth');
539  $tpl->addBlockFile("CONTENT",
540  "content",
541  "tpl.login_account_migration.html",
542  "Services/Init");
543 
544  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
545  $form = new ilPropertyFormGUI();
546  $form->setFormAction($this->ctrl->getFormAction($this,'migrateAccount'));
547 
548  $form->setTitle($lng->txt('auth_account_migration'));
549  $form->addCommandButton('migrateAccount', $lng->txt('save'));
550  $form->addCommandButton('showLogin', $lng->txt('cancel'));
551 
552  $rad = new ilRadioGroupInputGUI($lng->txt('auth_account_migration_name'),'account_migration');
553  $rad->setValue(1);
554 
555  $keep = new ilRadioOption($lng->txt('auth_account_migration_keep'),1,$lng->txt('auth_info_migrate'));
556  $user = new ilTextInputGUI($lng->txt('login'),'mig_username');
557  $user->setValue(ilUtil::prepareFormOutput($_POST['mig_username']));
558  $user->setSize(32);
559  $user->setMaxLength(128);
560  $keep->addSubItem($user);
561 
562  $pass = new ilPasswordInputGUI($lng->txt('password'),'mig_password');
563  $pass->setValue(ilUtil::prepareFormOutput($_POST['mig_password']));
564  $pass->setRetype(false);
565  $pass->setSize(12);
566  $pass->setMaxLength(128);
567  $keep->addSubItem($pass);
568  $rad->addOption($keep);
569 
570  $new = new ilRadioOption($lng->txt('auth_account_migration_new'),2,$lng->txt('auth_info_add'));
571  $rad->addOption($new);
572 
573  $form->addItem($rad);
574 
575  $tpl->setVariable('MIG_FORM',$form->getHTML());
576 
577  if(strlen($a_message))
578  {
579  $this->showFailure($a_message);
580  }
581 
582  $tpl->show('DEFAULT');
583  }
584 
591  public function migrateAccount()
592  {
593  global $lng,$ilClientIniFile,$ilLog,$rbacadmin;
594 
595  $lng->loadLanguageModule('auth');
596 
597  if(!isset($_POST['account_migration']))
598  {
599  $this->showAccountMigration($lng->txt('err_choose_migration_type'));
600  return false;
601  }
602 
603  if($_POST['account_migration'] == 1 and (!strlen($_POST['mig_username']) or !strlen($_POST['mig_password'])))
604  {
605  $this->showAccountMigration($lng->txt('err_wrong_login'));
606  return false;
607  }
608 
609  if($_POST['account_migration'] == 1)
610  {
611  if(!$user_id = ilObjUser::_lookupId(ilUtil::stripSlashes($_POST['mig_username'])))
612  {
613  $this->showAccountMigration($lng->txt('err_wrong_login'));
614  return false;
615  }
616  $_POST['username'] = $_POST['mig_username'];
617  $_POST['password'] = $_POST['mig_password'];
618 
619  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
620  include_once './Services/Database/classes/class.ilAuthContainerMDB2.php';
621 
623  $ilAuth->start();
624  if(!$ilAuth->checkAuth())
625  {
626  $ilAuth->logout();
627  $this->showAccountMigration($lng->txt('err_wrong_login'));
628  return false;
629  }
630 
631  $user = new ilObjUser($user_id);
632  $user->setAuthMode($_SESSION['tmp_auth_mode']);
633  $user->setExternalAccount($_SESSION['tmp_external_account']);
634  $user->update();
635 
636  // Assign to default role
637  if(is_array($_SESSION['tmp_roles']))
638  {
639  foreach($_SESSION['tmp_roles'] as $role)
640  {
641  $rbacadmin->assignUser((int) $role,$user->getId());
642  }
643  }
644 
645  // Log migration
646  $ilLog->write(__METHOD__.': Migrated '.$_SESSION['tmp_external_account'].' to ILIAS account '.$user->getLogin().'.');
647  }
648  elseif($_POST['account_migration'] == 2)
649  {
650  switch($_SESSION['tmp_auth_mode'])
651  {
652  case 'apache':
653  $_POST['username'] = $_SESSION['tmp_external_account'];
654  $_POST['password'] = $_SESSION['tmp_pass'];
655 
656  include_once('Services/Database/classes/class.ilAuthContainerApache.php');
657  $container = new ilAuthContainerApache();
658  $container->forceCreation(true);
659  $ilAuth = ilAuthFactory::factory($container);
660  $ilAuth->start();
661  break;
662 
663  case 'ldap':
664  $_POST['username'] = $_SESSION['tmp_external_account'];
665  $_POST['password'] = $_SESSION['tmp_pass'];
666 
667  include_once('Services/LDAP/classes/class.ilAuthContainerLDAP.php');
668  $container = new ilAuthContainerLDAP();
669  $container->forceCreation(true);
670  $ilAuth = ilAuthFactory::factory($container);
671  $ilAuth->start();
672  break;
673 
674  case 'radius':
675  $_POST['username'] = $_SESSION['tmp_external_account'];
676  $_POST['password'] = $_SESSION['tmp_pass'];
677 
678  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
679  include_once './Services/Radius/classes/class.ilAuthContainerRadius.php';
680 
681  $container = new ilAuthContainerRadius();
682  $container->forceCreation(true);
683  $ilAuth = ilAuthFactory::factory($container);
684  $ilAuth->start();
685  break;
686 
687  case 'openid':
688  $_POST['username'] = $_SESSION['tmp_external_account'];
689  $_POST['password'] = $_SESSION['tmp_pass'];
690  $_POST['oid_username'] = $_SESSION['tmp_oid_username'];
691  $_SESSION['force_creation'] = true;
692 
693  include_once './Services/Authentication/classes/class.ilAuthFactory.php';
694  include_once './Services/OpenId/classes/class.ilAuthContainerOpenId.php';
695 
696  $container = new ilAuthContainerOpenId();
697  $container->forceCreation(true);
699  $ilAuth = ilAuthFactory::factory($container);
700  $ilAuth->callProvider($_POST['username'], null, null);
701  $ilAuth->start();
702  break;
703  }
704  }
705  // show personal desktop
706  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
707  }
708 
712  function showLogout()
713  {
714  global $tpl, $ilSetting, $ilAuth, $lng, $ilIliasIniFile;
715 
716  $ilAuth->logout();
717  session_destroy();
718 
719  // reset cookie
720  $client_id = $_COOKIE["ilClientId"];
721  ilUtil::setCookie("ilClientId","");
722 
723  //instantiate logout template
724  $tpl->addBlockFile("CONTENT", "content", "tpl.logout.html",
725  "Services/Init");
726 
727  if ($ilSetting->get("pub_section"))
728  {
729  $tpl->setCurrentBlock("homelink");
730  $tpl->setVariable("CLIENT_ID","?client_id=".$client_id."&lang=".$_GET['lang']);
731  $tpl->setVariable("TXT_HOME",$lng->txt("home"));
732  $tpl->parseCurrentBlock();
733  }
734 
735  if ($ilIliasIniFile->readVariable("clients","list"))
736  {
737  $tpl->setCurrentBlock("client_list");
738  $tpl->setVariable("TXT_CLIENT_LIST", $lng->txt("to_client_list"));
739  $this->ctrl->setParameter($this, "client_id", $client_id);
740  $tpl->setVariable("CMD_CLIENT_LIST",
741  $this->ctrl->getLinkTarget($this, "showClientList"));
742  $tpl->parseCurrentBlock();
743  $this->ctrl->setParameter($this, "client_id", "");
744  }
745 
746  $tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("logout"));
747  $tpl->setVariable("TXT_LOGOUT_TEXT", $lng->txt("logout_text"));
748  $tpl->setVariable("TXT_LOGIN", $lng->txt("login_to_ilias"));
749  $tpl->setVariable("CLIENT_ID","?client_id=".$client_id."&lang=".$_GET['lang']);
750 
751  $tpl->show();
752  }
753 
759  {
760  global $ilAuth, $tpl, $lng;
761 
762  $valid = $ilAuth->getValidationData();
763 
764  $tpl->addBlockFile("CONTENT", "content", "tpl.user_mapping_selection.html",
765  "Services/Init");
766  $email_user = ilObjUser::_getLocalAccountsForEmail($valid["email"]);
767 
768 
769  if ($ilAuth->sub_status == AUTH_WRONG_LOGIN)
770  {
771  $this->showFailure($lng->txt("err_wrong_login"));
772  }
773 
774  include_once('./Services/User/classes/class.ilObjUser.php');
775  if (count($email_user) == 1)
776  {
777  //$user = new ilObjUser(key($email_user));
778  $tpl->setCurrentBlock("one_user");
779  $tpl->setVariable("TXT_USERNAME", $lng->txt("username"));
780  $tpl->setVariable("VAL_USERNAME", current($email_user));
781  $tpl->setVariable("USER_ID", key($email_user));
782  $tpl->parseCurrentBlock();
783  }
784  else
785  {
786  foreach($email_user as $key => $login)
787  {
788  $tpl->setCurrentBlock("user");
789  $tpl->setVariable("USR_ID", $key);
790  $tpl->setVariable("VAL_USER", $login);
791  $tpl->parseCurrentBlock();
792  }
793  $tpl->setCurrentBlock("multpiple_user");
794  $tpl->parseCurrentBlock();
795  }
796 
797  $tpl->setCurrentBlock("content");
798  $this->ctrl->setParameter($this, "ext_uid", urlencode($_GET["ext_uid"]));
799  $this->ctrl->setParameter($this, "soap_pw", urlencode($_GET["soap_pw"]));
800  $this->ctrl->setParameter($this, "auth_stat", $_GET["auth_stat"]);
801  $tpl->setVariable("FORMACTION",
802  $this->ctrl->getFormAction($this));
803  $tpl->setVariable("TXT_ILIAS_LOGIN", $lng->txt("login_to_ilias"));
804  if (count($email_user) == 1)
805  {
806  $tpl->setVariable("TXT_EXPLANATION", $lng->txt("ums_explanation"));
807  $tpl->setVariable("TXT_EXPLANATION_2", $lng->txt("ums_explanation_2"));
808  }
809  else
810  {
811  $tpl->setVariable("TXT_EXPLANATION", $lng->txt("ums_explanation_3"));
812  $tpl->setVariable("TXT_EXPLANATION_2", $lng->txt("ums_explanation_4"));
813  }
814  $tpl->setVariable("TXT_CREATE_USER", $lng->txt("ums_create_new_account"));
815  $tpl->setVariable("TXT_PASSWORD", $lng->txt("password"));
816  $tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST["password"]));
817  $tpl->setVariable("TXT_SUBMIT", $lng->txt("login"));
818 
819  $tpl->show();
820  }
821 
825  function showClientList()
826  {
827  global $tpl, $ilIliasIniFile, $ilCtrl;
828 //echo "1";
829  if (!$ilIliasIniFile->readVariable("clients","list"))
830  {
831  $this->processIndexPHP();
832  return;
833  }
834 //echo "2";
835  $tpl = new ilTemplate("tpl.main.html", true, true);
836 
837  // to do: get standard style
838  $tpl->setVariable("PAGETITLE","Client List");
839  $tpl->setVariable("LOCATION_STYLESHEET","./templates/default/delos.css");
840 
841  // load client list template
842  $tpl->addBlockfile("CONTENT", "content", "tpl.client_list.html",
843  "Services/Init");
844 
845  // load template for table
846  $tpl->addBlockfile("CLIENT_LIST", "client_list", "tpl.table.html");
847 
848  // load template for table content data
849  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
850 
851  // load table content data
852  require_once("setup/classes/class.ilClientList.php");
853  require_once("setup/classes/class.ilClient.php");
854  require_once("setup/classes/class.ilDBConnections.php");
855  require_once("./Services/Table/classes/class.ilTableGUI.php");
856  $this->db_connections = new ilDBConnections();
857  $clientlist = new ilClientList($this->db_connections);
858  $list = $clientlist->getClients();
859 
860  if (count($list) == 0)
861  {
862  header("Location: ./setup/setup.php");
863  exit();
864  }
865 
866  foreach ($list as $key => $client)
867  {
868  $client->setDSN();
869  if ($client->checkDatabaseExists() and $client->ini->readVariable("client","access") and $client->getSetting("setup_ok"))
870  {
871  $this->ctrl->setParameter($this, "client_id", $key);
872  //$data[] = array(
873  // $client->getName(),
874  // "<a href=\"".$ilCtrl->getLinkTarget($this, "processIndexPHP")."\">Start page</a>",
875  // "<a href=\"".$ilCtrl->getLinkTarget($this, "showLogin")."\">Login page</a>"
876  // );
877  //$data[] = array(
878  // $client->getName(),
879  // "<a href=\"".$ilCtrl->getLinkTarget($this, "processIndexPHP")."\">Start page</a>",
880  // "<a href=\""."login.php?cmd=force_login&client_id=".urlencode($key)."\">Login page</a>"
881  // );
882  $data[] = array(
883  $client->getName(),
884  "<a href=\""."repository.php?client_id=".urlencode($key)."\">Start page</a>",
885  "<a href=\""."login.php?cmd=force_login&client_id=".urlencode($key)."\">Login page</a>"
886  );
887  }
888  }
889  $this->ctrl->setParameter($this, "client_id", "");
890 
891  // create table
892  $tbl = new ilTableGUI();
893 
894  // title & header columns
895  $tbl->setTitle("Available Clients");
896  $tbl->setHeaderNames(array("Installation Name","Public Access","Login"));
897  $tbl->setHeaderVars(array("name","index","login"));
898  $tbl->setColumnWidth(array("50%","25%","25%"));
899 
900  // control
901  $tbl->setOrderColumn($_GET["sort_by"],"name");
902  $tbl->setOrderDirection($_GET["sort_order"]);
903  $tbl->setLimit($_GET["limit"]);
904  $tbl->setOffset($_GET["offset"]);
905 
906  // content
907  $tbl->setData($data);
908 
909  // footer
910  $tbl->setFooter("tblfooter");
911 
912  // styles
913  $tbl->setStyle("table","std");
914 
915  $tbl->disable("icon");
916  $tbl->disable("numinfo");
917  $tbl->disable("sort");
918 
919  // render table
920  $tbl->render();
921  $tpl->show("DEFAULT", true, true);
922  }
923 
930  {
931  global $tpl;
932 
933  $str = "<p style=\"margin:15px;\">
934  You need to enable Session Cookies in your Browser to use ILIAS.
935  <br/>
936  <br/><b>Firefox</b>
937  <br/>Tools -> Options -> Privacy -> Cookies
938  <br/>Enable 'Allow sites to set cookies' and activate option 'Keep
939  <br/>cookies' auf 'until I close Firefox'
940  <br/>
941  <br/><b>Mozilla/Netscape</b>
942  <br/>Edit -> Preferences -> Privacy&Security -> Cookies
943  <br/>Go to 'Cookie Lifetime Policy' and check option 'Accept for current
944  <br/>session only'.
945  <br/>
946  <br/><b>Internet Explorer</b>
947  <br/>Tools -> Internet Options -> Privacy -> Advanced
948  <br/>- Check 'Override automatic cookie handling'
949  <br/>- Check 'Always allow session cookies'
950  </p>";
951  $tpl->setVariable("CONTENT", $str);
952  $tpl->show();
953  }
954 
958  function getAcceptance()
959  {
960  $this->showUserAgreement();
961  }
962 
966  function showUserAgreement()
967  {
968  global $lng, $tpl, $ilUser;
969 
970  require_once "./Services/User/classes/class.ilUserAgreement.php";
971 
972  $tpl->addBlockFile("CONTENT", "content", "tpl.view_usr_agreement.html",
973  "Services/Init");
974  $tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
975 
976 // ilUtil::sendInfo();
977  // display infopanel if something happened
979 
980  $tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
981  $tpl->setVariable("TXT_OK", $lng->txt("ok"));
982 
983  // language selection
984  $languages = $lng->getInstalledLanguages();
985 
986  $count = (int) round(count($languages) / 2);
987  $num = 1;
988 
989  foreach ($languages as $lang_key)
990  {
991  $tpl->setCurrentBlock("languages");
992  $tpl->setVariable("LANG_VAL_CMD", $this->ctrl->getCmd());
993  $tpl->setVariable("AGR_LANG_ACTION",
994  $this->ctrl->getFormAction($this));
995  $tpl->setVariable("LANG_NAME",
996  ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
997  $tpl->setVariable("LANG_ICON", $lang_key);
998  $tpl->setVariable("LANG_KEY", $lang_key);
999  $tpl->setVariable("BORDER", 0);
1000  $tpl->setVariable("VSPACE", 0);
1001  $tpl->parseCurrentBlock();
1002 
1003  $num++;
1004  }
1005  $tpl->setCurrentBlock("content");
1006 
1007  // display tabs
1008  $tpl->setVariable("TXT_PAGEHEADLINE", $lng->txt("usr_agreement"));
1009  $tpl->setVariable("TXT_PAGETITLE", "ILIAS3 - ".$lng->txt("usr_agreement"));
1010  $tpl->setVariable("TXT_USR_AGREEMENT", ilUserAgreement::_getText());
1011 
1012  if ($this->ctrl->getCmd() == "getAcceptance")
1013  {
1014  if ($_POST["status"]=="accepted")
1015  {
1016  $ilUser->writeAccepted();
1017  ilUtil::redirect("index.php?target=".$_GET["target"]."&client_id=".CLIENT_ID);
1018  }
1019  $tpl->setVariable("VAL_CMD", "getAcceptance");
1020  $tpl->setVariable("AGR_LANG_ACTION",
1021  $this->ctrl->getFormAction($this));
1022  $tpl->setCurrentBlock("get_acceptance");
1023  $tpl->setVariable("FORM_ACTION",
1024  $this->ctrl->getFormAction($this));
1025  $tpl->setVariable("ACCEPT_CHECKBOX", ilUtil::formCheckbox(0, "status", "accepted"));
1026  $tpl->setVariable("ACCEPT_AGREEMENT", $lng->txt("accept_usr_agreement"));
1027  $tpl->setVariable("TXT_SUBMIT", $lng->txt("submit"));
1028  $tpl->parseCurrentBlock();
1029  }
1030  else
1031  {
1032  $tpl->setCurrentBlock("back");
1033  $tpl->setVariable("BACK", $lng->txt("back"));
1034  $tpl->setVariable("LINK_BACK",
1035  $this->ctrl->getLinkTargetByClass("ilstartupgui", "showLogin"));
1036  $tpl->parseCurrentBlock();
1037  }
1038 
1039  $tpl->show();
1040 
1041 
1042  }
1043 
1047  function processIndexPHP()
1048  {
1049  global $ilIliasIniFile, $ilAuth, $ilSetting, $ilInit;
1050 
1051  // display client selection list if enabled
1052  if (!isset($_GET["client_id"]) &&
1053  $_GET["cmd"] == "" &&
1054  $ilIliasIniFile->readVariable("clients","list"))
1055  {
1056  $this->showClientList();
1057  //include_once "./include/inc.client_list.php";
1058  exit();
1059  }
1060 
1061  /*
1062  if ($_GET["cmd"] == "login")
1063  {
1064  $rep_ref_id = $_SESSION["il_rep_ref_id"];
1065 
1066  $ilAuth->logout();
1067  session_destroy();
1068 
1069  // reset cookie
1070  $client_id = $_COOKIE["ilClientId"];
1071  setcookie ("ilClientId","");
1072  $_COOKIE["ilClientId"] = "";
1073 
1074  $_GET["client_id"] = $client_id;
1075  $_GET["rep_ref_id"] = $rep_ref_id;
1076 
1077 
1078  ilUtil::redirect("login.php?client_id=".$client_id."&lang=".$_GET['lang'].
1079  "&rep_ref_id=".$rep_ref_id);
1080  }*/
1081 
1082 
1083  // if no start page was given, ILIAS defaults to the standard login page
1084  if ($start == "")
1085  {
1086  $start = "login.php";
1087  }
1088 
1089 
1090  //
1091  // index.php is called and public section is enabled
1092  //
1093  // && $ilAuth->status == -101 is important for soap auth (public section on + user mapping, alex)
1094  // $ilAuth->status -1 is given, if session ends (if public section -> jump to public section)
1095 
1096  if ($ilSetting->get("pub_section") && $_POST["sendLogin"] != "1"
1097  && ($ilAuth->getStatus() != -101 && $_GET["soap_pw"] == ""))
1098  {
1099  //
1100  // TO DO: THE FOLLOWING BLOCK IS COPY&PASTED FROM HEADER.INC
1101 
1102  $_POST["username"] = "anonymous";
1103  $_POST["password"] = "anonymous";
1104 
1105  $oldSid = session_id();
1106 
1107  $ilAuth->start();
1108  if (ANONYMOUS_USER_ID == "")
1109  {
1110  die ("Public Section enabled, but no Anonymous user found.");
1111  }
1112  if (!$ilAuth->getAuth())
1113  {
1114  die("ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID." not found!");
1115  }
1116 
1117  $newSid = session_id();
1118  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
1119  ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
1120 
1121  // get user id
1122  $ilInit->initUserAccount();
1123  $this->processStartingPage();
1124 
1125  exit;
1126  }
1127  else
1128  {
1129  // index.php is called and public section is disabled
1130  $this->showLogin();
1131  }
1132  }
1133 
1134 
1141  {
1142  global $ilBench, $ilCtrl, $ilAccess, $lng, $ilUser;
1143 //echo "here";
1144  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID || !empty($_GET["ref_id"]))
1145  {
1146 //echo "A";
1147  // if anonymous and a target given...
1148  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID && $_GET["target"] != "")
1149  {
1150  // target is accessible -> goto target
1151  if ($this->_checkGoto($_GET["target"]))
1152  {
1153 //echo "B";
1154  ilUtil::redirect("./goto.php?target=".$_GET["target"]);
1155  }
1156  else // target is not accessible -> login
1157  {
1158 //echo "C";
1159  $this->showLogin();
1160  }
1161  }
1162 
1163  // just go to public section
1164  if (empty($_GET["ref_id"]))
1165  {
1166  $_GET["ref_id"] = ROOT_FOLDER_ID;
1167  }
1168  $ilCtrl->initBaseClass("");
1169  $ilCtrl->setCmd("frameset");
1170  $start_script = "repository.php";
1171  include($start_script);
1172  return true;
1173  }
1174  else
1175  {
1176  if(IS_PAYMENT_ENABLED)
1177  {
1178  $usr_id = $ilUser->getId();
1179  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
1181  }
1182 
1183  if (!$this->_checkGoto($_GET["target"]))
1184  {
1185  // message if target given but not accessible
1186  if ($_GET["target"] != "")
1187  {
1188  $tarr = explode("_", $_GET["target"]);
1189  if ($tarr[0] != "pg" && $tarr[0] != "st" && $tarr[1] > 0)
1190  {
1191  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1193  }
1194  }
1195 
1196  // show personal desktop
1197  #$ilCtrl->initBaseClass("ilPersonalDesktopGUI");
1198  #$start_script = "ilias.php";
1199  // Redirect here to switch back to http if desired
1200  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
1201  }
1202  else
1203  {
1204 //echo "3";
1205  ilUtil::redirect("./goto.php?target=".$_GET["target"]);
1206  }
1207  }
1208 
1209  include($start_script);
1210  }
1211 
1212  function _checkGoto($a_target)
1213  {
1214  global $objDefinition;
1215 
1216  if ($a_target == "")
1217  {
1218  return false;
1219  }
1220 
1221  $t_arr = explode("_", $_GET["target"]);
1222  $type = $t_arr[0];
1223 
1224  if ($type == "git")
1225  {
1226  $type = "glo";
1227  }
1228 
1229  if ($type == "pg" | $type == "st")
1230  {
1231  $type = "lm";
1232  }
1233 
1234  $class = $objDefinition->getClassName($type);
1235  if ($class == "")
1236  {
1237  return false;
1238  }
1239  $location = $objDefinition->getLocation($type);
1240  $full_class = "ilObj".$class."Access";
1241  include_once($location."/class.".$full_class.".php");
1242 
1243  return call_user_func(array($full_class, "_checkGoto"),
1244  $a_target);
1245  }
1246 
1247  public function confirmRegistration()
1248  {
1249  global $lng, $ilias, $ilLog;
1250 
1251  ilUtil::setCookie('iltest', 'cookie', false);
1252 
1253  if(!isset($_GET['rh']) || !strlen(trim($_GET['rh'])))
1254  {
1255  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=reg_confirmation_hash_not_passed');
1256  }
1257 
1258  try
1259  {
1260  require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
1261  $oRegSettings = new ilRegistrationSettings();
1262 
1265  $oUser->setActive(true);
1266  if($oRegSettings->passwordGenerationEnabled())
1267  {
1268  $passwd = ilUtil::generatePasswords(1);
1269  $password = $passwd[0];
1270  $oUser->setPasswd($password, IL_PASSWD_PLAIN);
1271  $oUser->setLastPasswordChangeTS( time() );
1272  }
1273  $oUser->update();
1274 
1275  if($lng->getLangKey() != $oUser->getPref('language'))
1276  {
1277  $lng = new ilLanguage($oUser->getPref('language'));
1278  }
1279 
1280  // send email
1281  // try individual account mail in user administration
1282  include_once("Services/Mail/classes/class.ilAccountMail.php");
1283  include_once './Services/User/classes/class.ilObjUserFolder.php';
1284  $amail = ilObjUserFolder::_lookupNewAccountMail($oUser->getPref('language'));
1285  if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
1286  {
1287  $acc_mail = new ilAccountMail();
1288  $acc_mail->setUser($oUser);
1289  if($oRegSettings->passwordGenerationEnabled())
1290  {
1291  $acc_mail->setUserPassword($password);
1292  }
1293  $acc_mail->send();
1294  }
1295  else // do default mail
1296  {
1297  include_once 'Services/Mail/classes/class.ilMail.php';
1298  $mail_obj = new ilMail(ANONYMOUS_USER_ID);
1299 
1300  // mail subject
1301  $subject = $lng->txt("reg_mail_subject");
1302 
1303  // mail body
1304  $body = $lng->txt("reg_mail_body_salutation")." ".$oUser->getFullname().",\n\n".
1305  $lng->txt("reg_mail_body_text1")."\n\n".
1306  $lng->txt("reg_mail_body_text2")."\n".
1307  ILIAS_HTTP_PATH."/login.php?client_id=".CLIENT_ID."\n";
1308  $body .= $lng->txt("login").": ".$oUser->getLogin()."\n";
1309 
1310  if($oRegSettings->passwordGenerationEnabled())
1311  {
1312  $body.= $lng->txt("passwd").": ".$password."\n";
1313  }
1314 
1315  $body.= "\n";
1316  $body.= $lng->txt('reg_mail_body_forgot_password_info')."\n";
1317 
1318  $body.= "\n";
1319 
1320  $body .= ($lng->txt("reg_mail_body_text3")."\n\r");
1321  $body .= $oUser->getProfileAsString($lng);
1322  $mail_obj->enableSoap(false);
1323  $mail_obj->appendInstallationSignature(true);
1324  $mail_obj->sendMail($oUser->getEmail(), '', '',
1325  $subject,
1326  $body,
1327  array(), array('normal'));
1328  }
1329 
1330  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg=reg_account_confirmation_successful');
1331  }
1332  catch(ilRegConfirmationLinkExpiredException $exception)
1333  {
1334  include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
1335  $soap_client = new ilSoapClient();
1336  $soap_client->setTimeout(1);
1337  $soap_client->setResponseTimeout(1);
1338  $soap_client->enableWSDL(true);
1339  $soap_client->init();
1340 
1341  $ilLog->write(__METHOD__.': Triggered soap call (background process) for deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
1342 
1343  $soap_client->call
1344  (
1345  'deleteExpiredDualOptInUserObjects',
1346  array
1347  (
1348  $_COOKIE['PHPSESSID'].'::'.$_COOKIE['ilClientId'], // session id and client id, not used for checking access -> not possible for anonymous
1349  $exception->getCode() // user id
1350  )
1351  );
1352 
1353  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg='.$exception->getMessage());
1354  }
1355  catch(ilRegistrationHashNotFoundException $exception)
1356  {
1357  ilUtil::redirect('./login.php?cmd=force_login&reg_confirmation_msg='.$exception->getMessage());
1358  }
1359  }
1360 
1365  protected function showOpenIdLogin()
1366  {
1367  global $lng,$tpl;
1368 
1369  include_once './Services/OpenId/classes/class.ilOpenIdSettings.php';
1370  if(!ilOpenIdSettings::getInstance()->isActive())
1371  {
1372  return;
1373  }
1374 
1375  $lng->loadLanguageModule('auth');
1376 
1377  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1378  $form = new ilPropertyFormGUI();
1379  $form->setFormAction($this->ctrl->getFormAction($this,'login'));
1380  $form->setTitle($lng->txt('login_to_ilias_via_openid'));
1381 
1382  $openid = new ilTextInputGUI($lng->txt('auth_openid_login'),'oid_username');
1383  $openid->setSize(18);
1384  $openid->setMaxLength(255);
1385  $openid->setRequired(true);
1386  $openid->setCssClass('ilOpenIDBox');
1387  $openid->setInfo($lng->txt('auth_openid_login_info_a'));
1388  $form->addItem($openid);
1389 
1390  include_once './Services/OpenId/classes/class.ilOpenIdProviders.php';
1391  $pro = new ilSelectInputGUI($lng->txt('auth_openid_provider'),'oid_provider');
1392  $pro->setOptions(ilOpenIdProviders::getInstance()->getProviderSelection());
1393  $pro->setValue(ilOpenIdProviders::getInstance()->getSelectedProvider());
1394  $form->addItem($pro);
1395 
1396 
1397  $form->addCommandButton("showLogin", $lng->txt("log_in"));
1398 
1399  $tpl->setVariable('OID_LOGIN_FORM',$form->getHTML());
1400  }
1401 }
1402 ?>