Can anyone see whats wrong here? This was working a minute ago - and I don't remember changing anything!
Whats supposed to happen is that the password is hashed with a challenge in txtChallenge and the plain text password field replaced with that hash before the form submits. It looks like the function isn't even fireing... (I stuck an alert in on the first line of the function and it didn't show)
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Login Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="md5.js"></script>
<script type="text/javascript">
<!--
cmdLogin.onclick = getResponse();
function getResponse() {
// Set up some variables
var theform;
var challenge;
var response;
var password;
var toHash;
// Get the form
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document._ctl0;
}
else {
theform = document.forms["_ctl0"];
}
// Generate the hash
challenge = theform.txtChallenge.value;
password = theform.txtPassword.value;
toHash = password + challenge;
response = hex_md5(toHash);
// Set the form values
theform.txtPassword.value = response;
}
// -->
</script>
</head>
<body>
<h1>Login</h1>
<form name="_ctl0" method="post" action="login.aspx?ReturnUrl=%2fprotected%2findex.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE" value="dDwxNzI3MTQ4OTU7Oz52+oy1BwCxx49fAld7lOOdnqNufw==" />
<span>Username: <input name="txtUsername" type="text" id="txtUsername" /></span><br />
<span>Password: <input name="txtPassword" type="password" id="txtPassword" /></span><br />
<input name="txtChallenge" id="txtChallenge" type="hidden" value="cd0e7eL2ajqIZhBkTyfiqe8=" />
<input type="submit" name="cmdLogin" value="Login" id="cmdLogin" /><br />
</form>
</body>
</html>
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
Last edited by Minaki; 05-10-2005 at 10:39 AM..
|