Advertisement
yurikvelo

JS Auth

Jun 26th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function doSend(what){ // main auth
  2.  what.password.value=MD5(what.pass.value);
  3.  what.password.value=MD5(what.password.value+what.nonce.value);
  4.  what.pass.value=''; // NOT to send password as a plain text
  5.  what.nonce.value='';// NOT to send random key
  6.  what.pass.disabled=true;
  7.  what.nonce.disabled=true;
  8.  what.screenw.value=screen.width;
  9. }
  10.  
  11. function checkNonce(f_nonce){
  12.  c_nonce = getCookie('old_nonce');
  13.  //f_nonce = what.nonce.value;
  14.  //alert(c_nonce + '\n'+ f_nonce);
  15.     if (c_nonce == f_nonce){
  16.         window.location.reload();
  17.     }
  18. }
  19.  
  20. function getCookie(name) {
  21.         var prefix = name + "="
  22.         var cookieStartIndex = document.cookie.indexOf(prefix)
  23.         if (cookieStartIndex == -1)
  24.                 return null
  25.         var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
  26.         if (cookieEndIndex == -1)
  27.                 cookieEndIndex = document.cookie.length
  28.         return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
  29. }
  30.  
  31.  
  32.           <script language="Javascript" src=img/js/md5.js></script>
  33.             <form action="?handler" method=POST name=f onsubmit="doSend(this);">
  34.             {tlog}:{tpass}
  35.             <input type=text size=12 class=inp name=login value="{login}">:<input type=password size=12 class=inp name=pass>
  36.             <input type=submit class=but value="&gt;" {light}>
  37.             <input type=hidden name=action value=auth><input type=hidden name=sub value=login>
  38.             <input type=hidden name=password><input type=hidden name=nonce value={nonce}>
  39.             <input type=hidden name=screenw>
  40.             </form>
  41.             <script language="Javascript">
  42.                 checkNonce(document.f.nonce.value);
  43.                 // window.location.reload();
  44.             </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement