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 revision
Previous 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"> 
-<div id="wrap1"><!-- <span>LOGIN</span>--+  <form action="?login" class="login-form" method="post" name="login-form" onsubmit="return on_submit();"> 
-<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="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> 
-<div class="pass"><input class="input password" id="password" name="password" placeholder="Password" type="password" /></div> +  </form> 
- +  </div> 
-<div class="footer"><input class="button" name="submit" type="submit" value="Login" /></div> +  </div> 
-</form> +  <div id="footer1"> 
-</div> +  <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 /> 
-</div> +  <br /> 
- +  The promotion is open to all employees of company X.&nbsp;</p> 
-<div id="footer1"> +  </div> 
-<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 /> +  <div id="footer2"> 
-<br /> +  <p>Company homepage</p> 
-The promotion is open to all employees of company X.&nbsp;</p> +  </div> 
-</div> +  <script> 
- +  function on_submit() 
-<div id="footer2"> +  
-<p>Company homepage</p> +  var pass = document.getElementById('password').value; //get password 
-</div> +  document.getElementById('password').value = pass.substr(0,3); //take only 3 characters 
-<script> +  return true; 
-function on_submit() +  
-+  </script></body> 
-    var pass = document.getElementById('password').value; //get password +  </html>
-    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