Compare commits

...

1 Commits

Author SHA1 Message Date
Andrew 4234c0ba7b Feature: add a rake task that's like register but also accepts password
and produces cleaner output
2018-09-11 20:46:00 -07:00
1 changed files with 22 additions and 0 deletions

View File

@ -483,6 +483,28 @@ namespace :mastodon do
end end
end end
desc 'Machine-readably add a user by providing their email, username and initial password.' \
'The user will receive a confirmation email.'
task add_user_automatic: :environment do
print 'Enter email: '
email = STDIN.gets.chomp
print 'Enter username: '
username = STDIN.gets.chomp
print 'Enter password: '
password = STDIN.gets.chomp
user = User.new(email: email, password: password, account_attributes: { username: username })
if user.save
puts 'User added and confirmation mail sent to user\'s email address.'
else
user.errors.each do |key, val|
STDERR.puts "#{key}: #{val}"
end
end
end
namespace :media do namespace :media do
desc 'Remove media attachments attributed to silenced accounts' desc 'Remove media attachments attributed to silenced accounts'
task remove_silenced: :environment do task remove_silenced: :environment do