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
1 changed files with 5 additions and 2 deletions

View File

@ -22,8 +22,7 @@ task "admin:create" => :environment do
# create new user
admin = User.new
admin.email = email
username_random = Random.new()
admin.username = "admin_#{username_random.rand(9999)}"
admin.username = UserNameSuggester.suggest(admin.email)
begin
password = ask("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 while !saved
say "\nEnsuring account is active!"
admin.active = true
admin.save
if existing_user
say("\nAccount updated successfully!")
else