about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAsh Furrow <ash@ashfurrow.com>2017-04-08 19:09:46 -0400
committerwxcafé <wxcafe@users.noreply.github.com>2017-04-09 01:09:46 +0200
commit6e3925521d152808febf273312c73a09e3d3feb3 (patch)
treec30642472f5a2c3cfefbb39a0b46eba185cfeb38
parentb89f007862bb06bbf892c4f37dbc31ed83138b53 (diff)
Adds user confirmation rake task (#1300)
* Adds task to confirm user by email.

* Adds documentation for manual confirmation.
-rw-r--r--docs/Running-Mastodon/Administration-guide.md8
-rw-r--r--lib/tasks/mastodon.rake9
2 files changed, 17 insertions, 0 deletions
diff --git a/docs/Running-Mastodon/Administration-guide.md b/docs/Running-Mastodon/Administration-guide.md
index 09b0f1df1..8bcfe7c9e 100644
--- a/docs/Running-Mastodon/Administration-guide.md
+++ b/docs/Running-Mastodon/Administration-guide.md
@@ -35,3 +35,11 @@ You are able to set the following settings:
 - Site extended description
 
 You may wish to use the extended description (shown at https://yourmastodon.instance/about/more ) to display content guidelines or a user agreement (see https://mastodon.social/about/more for an example).
+
+## Confirming Users Manually
+
+The following rake task:
+
+    RAILS_ENV=production bundle exec rails mastodon:confirm_email USER_EMAIL=alice@alice.com
+
+Will confirm a user manually, in case they don't have access to their confirmation email for whatever reason.
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 79dcb722a..5dc7f1567 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -10,6 +10,15 @@ namespace :mastodon do
     puts "Congrats! #{user.account.username} is now an admin. \\o/\nNavigate to #{admin_settings_url} to get started"
   end
 
+  desc 'Manually confirms a user with associated user email address stored in USER_EMAIL environment variable.'
+  task confirm_email: :environment do
+    email = ENV.fetch('USER_EMAIL')
+    user = User.where(email: email)
+    user.update(confirmed_at: Time.now.utc)
+
+    puts "User #{email} confirmed."
+  end
+
   namespace :media do
     desc 'Removes media attachments that have not been assigned to any status for longer than a day'
     task clear: :environment do