FIX: rake admin:create suggests better name

FIX: rake admin:create ensures account active
This commit is contained in:
Sam 2014-07-16 17:54:40 +10:00
parent e347eea629
commit a2a78fbad1

View file

@ -22,8 +22,7 @@ task "admin:create" => :environment do
# create new user # create new user
admin = User.new admin = User.new
admin.email = email admin.email = email
username_random = Random.new() admin.username = UserNameSuggester.suggest(admin.email)
admin.username = "admin_#{username_random.rand(9999)}"
begin begin
password = ask("Password: ") {|q| q.echo = false} password = ask("Password: ") {|q| q.echo = false}
password_confirmation = ask("Repeat password: ") {|q| q.echo = false} password_confirmation = ask("Repeat password: ") {|q| q.echo = false}
@ -39,6 +38,10 @@ task "admin:create" => :environment do
end end
end while !saved end while !saved
say "\nEnsuring account is active!"
admin.active = true
admin.save
if existing_user if existing_user
say("\nAccount updated successfully!") say("\nAccount updated successfully!")
else else