FIX: rake admin:create suggests better name
FIX: rake admin:create ensures account active
This commit is contained in:
parent
e347eea629
commit
a2a78fbad1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue