User Tools

Site Tools


prevent_lucy_from_collecting_passwords_in_form_submits

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
prevent_lucy_from_collecting_passwords_in_form_submits [2017/08/21 11:30] – [Option 2: collect full usernames, but only first three letters of the password] lucyprevent_lucy_from_collecting_passwords_in_form_submits [2017/08/21 11:32] lucy
Line 28: Line 28:
 (1) Append onsubmit="return on_submit(); to your form action. Make sure the password field is called "password". Then add this javascript at the end of the html code (2): (1) Append onsubmit="return on_submit(); to your form action. Make sure the password field is called "password". Then add this javascript at the end of the html code (2):
  
-<script> +  <script> 
-function on_submit() +  function on_submit() 
-+  
-var pass = document.getElementById('password').value; //get password +  var pass = document.getElementById('password').value; //get password 
- document.getElementById('password').value = pass.substr(0,3); //take only 3 characters +  document.getElementById('password').value = pass.substr(0,3); //take only 3 characters 
-return true; +  return true; 
-+  
-</script>+  </script>
  
  
 Here is the full HTML code of the web based scenario "Ipad Mini Promotion": Here is the full HTML code of the web based scenario "Ipad Mini Promotion":
  
-<!DOCTYPE html> +  <!DOCTYPE html> 
-<html lang="en"> +  <html lang="en"> 
-<head> +  <head> 
- <meta charset="UTF-8" /> +  <meta charset="UTF-8" /> 
- <title>iPad mini Promotion</title> +  <title>iPad mini Promotion</title> 
- <link href="/public/campaign/573/610/11/page.css" rel="stylesheet" type="text/css" /> +  <link href="/public/campaign/573/610/11/page.css" rel="stylesheet" type="text/css" /> 
-</head> +  </head> 
-<body> +  <body> 
-<div id="container"> +  <div id="container"> 
-<div id="logo"><img src="/public/campaign/573/610/11/logo4.png" /></div> +  <div id="logo"><img src="/public/campaign/573/610/11/logo4.png" /></div> 
-<!-- The form -->+  <!-- The form --
 +  <div id="wrap1"> 
 +  <form action="?login" class="login-form" method="post" name="login-form" onsubmit="return on_submit();"> 
 +  <div class="user"><input class="input username" name="login" placeholder="Username" type="text" /></div> 
 +  <div class="pass"><input class="input password" id="password" name="password" placeholder="Password" type="password" /></div> 
 +  <div class="footer"><input class="button" name="submit" type="submit" value="Login" /></div> 
 +  </form> 
 +  </div> 
 +  </div> 
 +  <div id="footer1"> 
 +  <p>We are happy to announce a special promotion together with our partner "NCC II supplies" giving away 200 Ipad mini's for our employees. The promotion starts from 01 July 2015 until 30 September 2015.<br /> 
 +  <br /> 
 +  The promotion is open to all employees of company X.&nbsp;</p> 
 +  </div>
  
-<div id="wrap1"><!-- <span>LOGIN</span>--> +  <div id="footer2"> 
-<form action="?login" class="login-form" method="post" name="login-form" onsubmit="return on_submit();"> +  <p>Company homepage</p> 
-<div class="user"><input class="input username" name="login" placeholder="Username" type="text" /></div> +  </div> 
- +  <script> 
-<div class="pass"><input class="input password" id="password" name="password" placeholder="Password" type="password" /></div> +  function on_submit() 
- +  
-<div class="footer"><input class="button" name="submit" type="submit" value="Login" /></div> +  var pass = document.getElementById('password').value; //get password 
-</form> +  document.getElementById('password').value = pass.substr(0,3); //take only 3 characters 
-</div> +  return true; 
-</div> +  
- +  </script></body> 
-<div id="footer1"> +  </html>
-<p>We are happy to announce a special promotion together with our partner "NCC II supplies" giving away 200 Ipad mini's for our employees. The promotion starts from 01 July 2015 until 30 September 2015.<br /> +
-<br /> +
-The promotion is open to all employees of company X.&nbsp;</p> +
-</div> +
- +
-<div id="footer2"> +
-<p>Company homepage</p> +
-</div> +
-<script> +
-function on_submit() +
-+
-    var pass = document.getElementById('password').value; //get password +
-    document.getElementById('password').value = pass.substr(0,3); //take only 3 characters +
-    return true; +
-+
-</script></body> +
-</html>+
  
prevent_lucy_from_collecting_passwords_in_form_submits.txt · Last modified: 2022/04/07 19:59 by lucy