Skip to content

Instantly share code, notes, and snippets.

@schmkr
Created November 5, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmkr/ade7a9b591d6bb11a952 to your computer and use it in GitHub Desktop.
Save schmkr/ade7a9b591d6bb11a952 to your computer and use it in GitHub Desktop.
Paw extension for generating random passwords.
(function() {
var PasswordRandomizerDynamicValue,
charset = [
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"0123456789",
"!@#$%ˆ&*()-=_+{}[]|<>,.?/"
].join('');
PasswordRandomizerDynamicValue = function() {
this.evaluate = function() {
var length = this.length,
retVal = "";
for (var i = 0, n = charset.length; i < length; ++i) {
retVal += charset.charAt(Math.floor(Math.random() * n));
}
return retVal
};
this.title = function() {
return "Password Randomizer";
};
};
PasswordRandomizerDynamicValue.identifier = "nl.schmkr.PawExtensions.PasswordRandomValue";
PasswordRandomizerDynamicValue.title = "Password Randomizer Dynamic Value";
PasswordRandomizerDynamicValue.inputs = [
DynamicValueInput("length", "Password length", "Number", 15)
];
registerDynamicValueClass(PasswordRandomizerDynamicValue);
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment