Class: Lock::CreatePasswordFileGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/lock/create_password_file/create_password_file_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_password_fileObject



8
9
10
11
12
# File 'lib/generators/lock/create_password_file/create_password_file_generator.rb', line 8

def create_password_file
  password_salt = BCrypt::Engine.generate_salt
  password_hash = BCrypt::Engine.hash_secret(password, password_salt)
  create_file "config/lock_password", "#{password_hash}"
end