TYPO3 CMS  TYPO3_6-2
LoginFormHook.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Sv;
3 
23 
31  public function getLoginFormTag(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj) {
32  // Get the code according to the login level
33  switch ($pObj->loginSecurityLevel) {
34  case 'challenged':
35 
36  case 'superchallenged':
37  $_SESSION['login_challenge'] = $this->getChallenge();
38  $content = '<form action="index.php" method="post" name="loginform" ' . 'onsubmit="doChallengeResponse(' . ($pObj->loginSecurityLevel == 'challenged' ? 0 : 1) . ');">' . '<input type="hidden" name="challenge" value="' . htmlspecialchars($_SESSION['login_challenge']) . '" />';
39  break;
40  case 'normal':
41  $content = '<form action="index.php" method="post" name="loginform" onsubmit="document.loginform.userident.value=document.loginform.p_field.value;document.loginform.p_field.value=\'\';return true;">';
42  break;
43  default:
44  // No code for unknown level!
45  $content = '';
46  }
47  return $content;
48  }
49 
57  public function getLoginScripts(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj) {
58  $content = '';
59  if ($pObj->loginSecurityLevel == 'superchallenged' || $pObj->loginSecurityLevel == 'challenged') {
60  $content = '
61  <script type="text/javascript" src="sysext/backend/Resources/Public/JavaScript/md5.js"></script>
62  ' . $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
63  function doChallengeResponse(superchallenged) { //
64  password = document.loginform.p_field.value;
65  if (password) {
66  if (superchallenged) {
67  password = MD5(password); // this makes it superchallenged!!
68  }
69  str = document.loginform.username.value+":"+password+":"+document.loginform.challenge.value;
70  document.loginform.userident.value = MD5(str);
71  document.loginform.p_field.value = "";
72  return true;
73  }
74  }
75  ');
76  }
77  return $content;
78  }
79 
85  protected function getChallenge() {
86  $challenge = md5(uniqid('', TRUE) . getmypid());
87  return $challenge;
88  }
89 
90 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
getLoginScripts(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj)
getLoginFormTag(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj)