create a superadmin account

rake task create a superadmin account, and send
reset password instructions
This commit is contained in:
Christophe Robillard 2020-11-03 23:04:01 +01:00
parent 305ccdc0cd
commit 3fdb045356

View file

@ -18,10 +18,12 @@ namespace :superadmin do
email = args[:email]
rake_puts "Creating Administration for #{email}"
a = Administration.new(email: email, password: Devise.friendly_token[0, 20])
a = Administration.new(email: email, password: Devise.friendly_token)
if a.save
rake_puts "#{a.email} created"
a.send_reset_password_instructions
rake_puts "Password reset instructions sent to #{a.email}"
else
rake_puts "An error occured: #{a.errors.full_messages}"
end