Sha256: 3fd7168522ca9f8a82f7202019dfb5e1e957d0b61da0154438542ecc3ed14f80
Contents?: true
Size: 698 Bytes
Versions: 69
Compression:
Stored size: 698 Bytes
Contents
namespace :auth do namespace :password do desc "create password" task :create do require 'webrick/httpauth/htpasswd' puts 'create .htpasswd file' print 'Username: ' ARGV.replace([]) username = gets().chop print 'New password: ' system "stty -echo" password = $stdin.gets.chop puts print 'Re-type new password: ' password2 = $stdin.gets.chop puts system "stty echo" if password != password2 raise StandardError, 'password verification error' else htpasswd = WEBrick::HTTPAuth::Htpasswd.new('.htpasswd') htpasswd.set_passwd(nil, username, password) htpasswd.flush puts "Adding password for user #{username}" end end end end
Version data entries
69 entries across 58 versions & 1 rubygems