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

Version Path
thecore-1.7.7 db/migrate/20160331101902_add_admin_user.rb
thecore-1.7.5 db/migrate/20160331101902_add_admin_user.rb
thecore-1.7.3 db/migrate/20160331101902_add_admin_user.rb
thecore-1.7.2 db/migrate/20160331101902_add_admin_user.rb
thecore-1.7.1 db/migrate/20160331101902_add_admin_user.rb
thecore-1.7.0 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.13 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.10 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.9 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.8 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.7 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.5 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.4 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.3 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.2 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.1 db/migrate/20160331101902_add_admin_user.rb
thecore-1.6.0 db/migrate/20160331101902_add_admin_user.rb
thecore-1.5.14 db/migrate/20160331101902_add_admin_user.rb
thecore-1.5.13 db/migrate/20160331101902_add_admin_user.rb
thecore-1.5.12 db/migrate/20160331101902_add_admin_user.rb