Class: CM::Function::GeneratePassword

Inherits:
Object
  • Object
show all
Defined in:
lib/CM/function/generate_password.rb

Instance Method Summary collapse

Instance Method Details

#execute(args) ⇒ Object


Operations



18
19
20
21
22
23
# File 'lib/CM/function/generate_password.rb', line 18

def execute(args)
  super do
    length = (args.length == 1 ? args[0] : 40)
    `openssl rand -base64 "$((#{length} * 2))" | perl -pe 's/[^a-zA-Z0-9]//g' - | cut -c1-#{length}`
  end
end