c_AddUser with generate password feature

You can share your Lua Scripts with everybody here.

c_AddUser with generate password feature

Postby fox-it » Wed Jan 16, 2013 7:42 pm

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
fox-it
 
posts 1
 
joined Wed Jan 16, 2013 7:39 pm

Re: c_AddUser with generate password feature

Postby FTP » Thu Jan 17, 2013 11:08 am

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)
FTP
Site Admin
 
posts 1212
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest