summaryrefslogtreecommitdiff
path: root/httemplate/elements/random_pass.html
blob: b215b77d998b8fa0022df2caf342d1e72f95ddca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<INPUT TYPE="button" VALUE="<% emt($label) %>" onclick="randomPass()">
<SCRIPT TYPE="text/javascript">
function randomPass() {
  var i=0;
  var pw_set='<% join('', 'a'..'z', 'A'..'Z', '0'..'9' ) %>';
  var pass='';
  while(i < 8) {
    i++;
    pass += pw_set.charAt(Math.floor(Math.random() * pw_set.length));
  }
  document.getElementById('<% $id %>').value = pass;
}
</SCRIPT>
<%init>
my $id = shift;
my $label = shift || 'Generate';
</%init>