Project

General

Profile

Feature #18039 » felogin-trunk2944-2.diff

Administrator Admin, 2008-01-25 13:32

View differences:

typo3/sysext/felogin/ext_localconf.php (working copy)
}
');
t3lib_extMgm::addTypoScript($_EXTKEY,'setup','# Setting '.$_EXTKEY.' plugin TypoScript'.$addLine.'',43);
//activate support for kb_md5fepw
if (t3lib_extMgm::isLoaded('kb_md5fepw') && (TYPO3_MODE == 'FE')) {
$GLOBALS ['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'][] = 'tx_kbmd5fepw_newloginbox->loginFormOnSubmit';
require_once(t3lib_extMgm::extPath('kb_md5fepw').'pi1/class.tx_kbmd5fepw_newloginbox.php');
}
?>
typo3/sysext/felogin/ext_tables.sql (working copy)
#
# Table structure for table 'fe_groups'
#
CREATE TABLE fe_groups (
felogin_redirectPid tinytext
);
#
# Table structure for table 'fe_users'
#
CREATE TABLE fe_users (
felogin_redirectPid tinytext
);
#
# Table structure for table 'fe_groups'
#
CREATE TABLE fe_groups (
felogin_redirectPid tinytext
);
#
# Table structure for table 'fe_users'
#
CREATE TABLE fe_users (
felogin_redirectPid tinytext
);
CREATE TABLE tx_felogin_challenge (
challenge varchar(100) DEFAULT '' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (challenge)
);
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (working copy)
$onSubmit = implode('; ', $onSubmitAr).'; return true;';
$extraHidden = implode(chr(10), $extraHiddenAr);
}
// Implements the MD5 superchallenged On Submit as in Hook
// keeps hook in mind
if ( $GLOBALS['TYPO3_CONF_VARS']['FE']['passwordType'] == 'md5' && $GLOBALS['TYPO3_CONF_VARS']['FE']['loginSecurityLevel'] == 'superchallenged') {
list($onSub, $hid) = $this->getFormOnSubmitMD5();
$onSubmit = $onSub . $onSubmit;;
$extraHidden .= $hid;
}
// Login form
$markerArray['###ACTION_URI###'] = $this->getPageLink('',array(),true);
$markerArray['###EXTRA_HIDDEN###'] = $extraHidden; // used by kb_md5fepw extension...
......
}
return $pass;
}
/*
* return the additional onSubmit-JS Code, for superchallenged Login
* copied from kb_md5fepw/class.tx_kbmd5fepw_newloginbox.php
* original Name loginFormOnSubmit()
*/
private function getFormOnSubmitMD5() {
$js = '
function superchallenge_pass(form) {
var pass = form.pass.value;
if (pass) {
var enc_pass = MD5(pass);
var str = form.user.value+":"+enc_pass+":"+form.challenge.value;
form.pass.value = MD5(str);
return true;
} else {
return false;
}
}
';
$GLOBALS['TSFE']->JSCode .= $js;
$GLOBALS['TSFE']->additionalHeaderData['tx_felogin'] = '<script language="JavaScript" type="text/javascript" src="typo3/md5.js"></script>';
$chal_val = md5(time().getmypid());
$res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_felogin_challenge', array('challenge' => $chal_val, 'tstamp' => time()));
$onSubmit = 'superchallenge_pass(this)';
$hidden = '<input type="hidden" name="challenge" value="'.$chal_val.'">';
return array($onSubmit, $hidden);
}
/**
* Returns the header / message value from flexform if present, else from locallang.xml
(3-3/3)