This commit is contained in:
2023-01-13 22:06:41 +00:00
parent 650ae96987
commit e47fa443f7
10 changed files with 228 additions and 196 deletions

View File

@@ -165,6 +165,30 @@ namespace Sockeye.Util
return Encoding.ASCII.GetString(bytes); // returns: "Hello world" for "48656C6C6F20776F726C64"
}
//Generate a random code for email validation and v7 license key fetching
//doesn't have to be perfect, it's only temporary and
//requires knowledge of the customer / trial user
//email address to use it so it's kind of 2 factor
public static string GenFetchCode()
{
//sufficient for this purpose
//https://stackoverflow.com/a/1344258/8939
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
var stringChars = new char[10];
var random = new Random();
for (int i = 0; i < stringChars.Length; i++)
{
stringChars[i] = chars[random.Next(chars.Length)];
}
var finalString = new String(stringChars);
return finalString;
}
}//eoc
}//eons