Hi Forum,
is there a way to create users with LUA and use the generate random password feature?
Would be nice to be able to create users on the command line and get a randomly generated password as output.
regards,
Benjamin
c_AddUser with generate password feature
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: c_AddUser with generate password feature
You can generate a random password like this:
Code: Select all
local password = ""
local charArray = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}
math.randomseed(os.time())
math.random()
for i=1,8 do
local nowindex = math.random(1,table.maxn(charArray))
password = password..charArray[nowindex]
end
print(password)