Sha256: f586f9f47ec0be5c0fad16a71bd1f4d7ef15053dbfcfd32495524b8aa4252b62
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 Bytes
Contents
require 'shhh/errors' module Shhh module App module Input class Handler def self.ask retries ||= 0 prompt('Password: ', :green) rescue ::OpenSSL::Cipher::CipherError STDERR.puts 'Invalid password. Please try again.' retry if (retries += 1) < 3 nil end def self.prompt(message, color) HighLine.new(STDIN, STDERR).ask(message.bold) { |q| q.echo = '•'.send(color) } end def self.new_password password = prompt('New Password : ', :blue) password_confirm = prompt('Confirm Password : ', :blue) raise Shhh::Errors::PasswordsDontMatch.new( 'The passwords you entered do not match.') if password != password_confirm raise Shhh::Errors::PasswordTooShort.new( 'Minimum length is 7 characters.') if password.length < 7 password end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shhh-1.3.0 | lib/shhh/app/input/handler.rb |