[TYPO3-dev] use kb_md5fepw in own extension
    Wolfgang Klinger 
    wolfgang at stufenlos.net
       
    Fri Jul  7 06:13:25 CEST 2006
    
    
  
 *hiya!*
 On Thu, 06 Jul 2006, Christoph Koehler wrote the following:
> I made my own login form, but now when I login, kb_md5fepw messes with it,  
> and I cannot disable it because registration still depends on it.
> So my question is, how exactly do I use it in my own extension? I couldn't  
> find very much documentation on that, and looking at the newloginbox  
> didn't answer my questions either.
 You'll have to include the typo3/md5.js and the 'superchallenge_pass' 
 javascript function in your HTML header
--------
<script language="JavaScript" type="text/javascript" src="typo3/md5.js"></script><script type="text/javascript">
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;
    }
}
</script>
--------
 Second add a challenge value to your form (you'll have to generate this with a USER_INT)
--------
temp.myform.20 = USER_INT
temp.myform.20.userFunc = user_mystuff->challenge_value
temp.myform.20.wrap = <input type="hidden" name="challenge" value="|" />
--------
class user_mystuff {
    function challenge_value($content, $conf) {
        $chal_val = md5(time().getmypid());
        $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_kbmd5fepw_challenge', array('challenge' => $chal_val, 'tstamp' => time()));
        return $this->cObj->stdWrap($chal_val, $conf);
    }
}
--------
 and then add an onsubmit handler to your <form> tag
--------
onsubmit="superchallenge_pass(this); return true;"
--------
 
 hope that helps and we are talking about the same thing ;-)
 bye
 Wolfgang
    
    
More information about the TYPO3-dev
mailing list