Commit 7b02570e authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'sarnold-random-password-user-gdk' into 'master'

Use a random password when generating users

See merge request gitlab-org/gitlab!42311
parents e317e8fa 5e4da48a
...@@ -22,7 +22,7 @@ class Gitlab::Seeder::Users ...@@ -22,7 +22,7 @@ class Gitlab::Seeder::Users
private private
def create_mass_users! def create_mass_users!
encrypted_password = Devise::Encryptor.digest(User, '12345678') encrypted_password = Devise::Encryptor.digest(User, random_password)
Gitlab::Seeder.with_mass_insert(MASS_USERS_COUNT, User) do Gitlab::Seeder.with_mass_insert(MASS_USERS_COUNT, User) do
ActiveRecord::Base.connection.execute <<~SQL ActiveRecord::Base.connection.execute <<~SQL
...@@ -49,6 +49,10 @@ class Gitlab::Seeder::Users ...@@ -49,6 +49,10 @@ class Gitlab::Seeder::Users
FROM users WHERE NOT admin FROM users WHERE NOT admin
SQL SQL
end end
puts '==========================================================='
puts "INFO: Password for newly created users is: #{random_password}"
puts '==========================================================='
end end
def create_random_users! def create_random_users!
...@@ -59,7 +63,7 @@ class Gitlab::Seeder::Users ...@@ -59,7 +63,7 @@ class Gitlab::Seeder::Users
name: FFaker::Name.name, name: FFaker::Name.name,
email: FFaker::Internet.email, email: FFaker::Internet.email,
confirmed_at: DateTime.now, confirmed_at: DateTime.now,
password: '12345678' password: random_password
) )
print '.' print '.'
...@@ -68,6 +72,10 @@ class Gitlab::Seeder::Users ...@@ -68,6 +72,10 @@ class Gitlab::Seeder::Users
end end
end end
end end
def random_password
@random_password ||= SecureRandom.hex.slice(0,16)
end
end end
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment