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

Version Path
tdiary-3.2.2.20130722 tdiary/tasks/auth.rake
tdiary-3.2.2.20130720 tdiary/tasks/auth.rake
tdiary-3.2.2.20130617 tdiary/tasks/auth.rake
tdiary-3.2.2.20130614 tdiary/tasks/auth.rake
tdiary-3.2.2.20130604 tdiary/tasks/auth.rake
tdiary-3.2.2.20130527 tdiary/tasks/auth.rake
tdiary-3.2.2.20130518 tdiary/tasks/auth.rake
tdiary-3.2.2.20130508 tdiary/tasks/auth.rake
tdiary-3.2.2.20130507 tdiary/tasks/auth.rake