Skip to content

Instantly share code, notes, and snippets.

@moxet
Created July 1, 2023 15:51
Show Gist options
  • Save moxet/ccc759b4bc6beaf8f0517781f617ff2c to your computer and use it in GitHub Desktop.
Save moxet/ccc759b4bc6beaf8f0517781f617ff2c to your computer and use it in GitHub Desktop.
Create Hidden Code & Send via Email
<script>
jQuery(document).ready(function($) {
var generatePassword = (
length = 20,
wishlist = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@-#$'
) =>
Array.from(crypto.getRandomValues(new Uint32Array(length)))
.map((x) => wishlist[x % wishlist.length])
.join('')
$('[name="activation_code"]').val(generatePassword());
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment