Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@web:accountapi/lib]# cat apicommon.rb (04-05 18:13)
- require 'yaml'
- class Apicommon
- def self.password(size = 9)
- chars = (('a'..'z').to_a + ('0'..'9').to_a) - %w(i o 0 1 l 0)
- password = (1..size).collect{|a| chars[rand(chars.size)] }.join
- return password
- end
- def self.salt
- chars = ('a'..'z').to_a
- salt = (1..2).collect{|a| chars[rand(chars.size)]}.join
- return salt
- end
- def self.loadconfig
- conffile = "config/accountapi.yml"
- if File::exists?(conffile)
- conffd = File.open(conffile)
- conf = YAML.load(conffd)
- conffd.close
- else
- puts "No configuration file found, exiting..."
- exit
- end
- $minuid=conf['minuid']
- $adminuser=conf['adminuser']
- $adminpassword=conf['adminpassword']
- $minpwdlength=conf['minpwdlength']
- $minuserlength=conf['minuserlength']
- end
- end
Add Comment
Please, Sign In to add comment