Created
October 23, 2015 08:31
-
-
Save artkirienko/caa2187e212301f06e5e to your computer and use it in GitHub Desktop.
admins_pass.rake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :admins_pass do | |
task :generate => :environment do | |
ids = [] | |
ids += (8..39).to_a | |
ids += [50, 48, 40, 42, 43, 44, 45, 46] | |
f = File.new("pas_admins", 'w') | |
ids.each do |id| | |
psw = ([*('A'..'Z'),*('0'..'9')]-%w(0 1 I O)).sample(8).join | |
u = User.where(email: "admin#{id}@admin.ru").first | |
unless u.nil? | |
u.password = psw | |
u.password_confirmation = psw | |
u.save | |
f.write("office id: #{id} email: #{u.email} password: #{psw}\n\n") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment