Class: PasswordHasher

Inherits:
Object
  • Object
show all
Defined in:
lib/balrog/password_hasher.rb

Class Method Summary collapse

Class Method Details

.encrypt_passwordObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/balrog/password_hasher.rb', line 5

def self.encrypt_password
  print "Enter New Password: "
  password = STDIN.noecho(&:gets).chomp
  print "\nConfirm New Password: "
  if password == STDIN.noecho(&:gets).chomp then
    password_hash = BCrypt::Password.create(password)
    puts "\n"
    password_hash 
  else 
    puts "\n"
    warn 'Passwords did not match :('
  end
end