Paul Douglas

Random Name Transform

Discussion created by Paul Douglas Employee on Oct 18, 2016

I was reminded today of an environment that I worked in that used random strings as usernames to minimise the ability for attackers to attempt log ins. This prompted me to put it together in G&L.

If this is of interest, here is a base to work from.

Create a new transform with no parameters

Definition

OUTPUT_VALUE = transform();
function transform()
{
var text = "";

chars = 8;
var availchars = "abcdefghijklmnopqrstuvwxyz";

for( var i=0; i < chars; i++ )
text += availchars.charAt(Math.floor(Math.random() * availchars.length));

return text;
}

From here you can choose the number of characters you'd like (8 in the example) and the characters that can be used (availchars). You could include uppercase, numbers etc. if required.

When paired with G&L's naming policy ability to enforce uniqueness, this can ensure no repeated values whilst providing a random string.

Outcomes