Commit 7e462cfcd2babcc4ae1be55aba2586f0326b42d9
1 parent
b31b460f
Exists in
master
and in
1 other branch
Update seed: random password during install
This seems superior to the default password of `'password'`. Thoughts on this?
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
db/seeds.rb
1 | +require 'securerandom' | |
2 | + | |
1 | 3 | puts "Seeding database" |
2 | 4 | puts "-------------------------------" |
3 | 5 | |
4 | 6 | # Create an initial Admin User |
5 | 7 | admin_username = "errbit" |
6 | 8 | admin_email = "errbit@#{Errbit::Config.host}" |
7 | -admin_pass = 'password' | |
9 | +admin_pass = SecureRandom.urlsafe_base64(12)[0,12] | |
8 | 10 | |
9 | 11 | puts "Creating an initial admin user:" |
10 | 12 | puts "-- username: #{admin_username}" if Errbit::Config.user_has_username |
11 | 13 | puts "-- email: #{admin_email}" |
12 | 14 | puts "-- password: #{admin_pass}" |
13 | 15 | puts "" |
14 | -puts "Be sure to change these credentials ASAP!" | |
16 | +puts "Be sure to note down these credentials now!" | |
15 | 17 | user = User.find_or_initialize_by(:email => admin_email) do |u| |
16 | 18 | u.name = 'Errbit Admin' |
17 | 19 | u.password = admin_pass | ... | ... |