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-5.3.0 lib/tdiary/tasks/auth.rake
tdiary-5.2.4 lib/tdiary/tasks/auth.rake
tdiary-5.2.3 lib/tdiary/tasks/auth.rake
tdiary-5.2.2 lib/tdiary/tasks/auth.rake
tdiary-5.2.1 lib/tdiary/tasks/auth.rake
tdiary-5.2.0 lib/tdiary/tasks/auth.rake
tdiary-5.1.7 lib/tdiary/tasks/auth.rake
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/lib/tdiary/tasks/auth.rake
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/lib/tdiary/tasks/auth.rake
tdiary-5.1.6 lib/tdiary/tasks/auth.rake
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/lib/tdiary/tasks/auth.rake
tdiary-5.1.5 lib/tdiary/tasks/auth.rake
tdiary-5.1.4 lib/tdiary/tasks/auth.rake
tdiary-5.1.3 lib/tdiary/tasks/auth.rake
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/lib/tdiary/tasks/auth.rake
tdiary-5.1.2 lib/tdiary/tasks/auth.rake
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tdiary-5.0.14/lib/tdiary/tasks/auth.rake
tdiary-5.1.1 lib/tdiary/tasks/auth.rake
tdiary-5.1.0 lib/tdiary/tasks/auth.rake
tdiary-5.0.14 lib/tdiary/tasks/auth.rake