Sha256: d8a8303df56fbd27833285f76a2662a7f8fe9566f80ec0edbbfe83bc95b5f3d2
Contents?: true
Size: 574 Bytes
Versions: 29
Compression:
Stored size: 574 Bytes
Contents
class AddAdminUser < ActiveRecord::Migration[4.2] def up puts "Generating admin user" User.reset_column_information u=User.find_or_initialize_by(username: "admin") puts "Utente Admin: #{u.inspect}" u.email = "admin@example.com" psswd = SecureRandom.hex(5) puts "\tThecore admin password is:\n\n\t\t#{psswd}\n\n\tplease save it somewhere, securely." File.open('.passwords', 'w') do |f| f.write(psswd) end u.password = psswd u.password_confirmation = psswd u.admin = true # u.skip_confirmation! u.save end end
Version data entries
29 entries across 29 versions & 1 rubygems