diff --git a/config.example.py b/config.example.py
index eeb7722..ed81c65 100644
--- a/config.example.py
+++ b/config.example.py
@@ -14,6 +14,16 @@ MAINTENANCE_MODE_MESSAGE = 'Site is currently in read-only maintenance mode.'
# Allow logging in during maintenance (without updating last login date)
MAINTENANCE_MODE_LOGINS = True
+# Block *anonymous* uploads completely
+RAID_MODE_LIMIT_UPLOADS = False
+# Message prepended to the full error message (account.py)
+RAID_MODE_UPLOADS_MESSAGE = 'Anonymous uploads are currently disabled.'
+
+# Require manual activation for newly registered accounts
+RAID_MODE_LIMIT_REGISTER = False
+# Message prepended to the full error message (account.py)
+RAID_MODE_REGISTER_MESSAGE = 'Registration is currently being limited.'
+
#############
## General ##
#############
diff --git a/nyaa/backend.py b/nyaa/backend.py
index 7ddb511..45ad8e7 100644
--- a/nyaa/backend.py
+++ b/nyaa/backend.py
@@ -172,7 +172,11 @@ def handle_torrent_upload(upload_form, uploading_user=None, fromAPI=False):
raise TorrentExtraValidationException()
if not uploading_user:
- if models.RangeBan.is_rangebanned(ip_address(flask.request.remote_addr).packed):
+ if app.config['RAID_MODE_LIMIT_UPLOADS']:
+ # XXX TODO: rename rangebanned to something more generic
+ upload_form.rangebanned.errors = [app.config['RAID_MODE_UPLOADS_MESSAGE']]
+ raise TorrentExtraValidationException()
+ elif models.RangeBan.is_rangebanned(ip_address(flask.request.remote_addr).packed):
upload_form.rangebanned.errors = ["Your IP is banned from "
"uploading anonymously."]
raise TorrentExtraValidationException()
diff --git a/nyaa/views/account.py b/nyaa/views/account.py
index 6f02c06..f4fe6a0 100644
--- a/nyaa/views/account.py
+++ b/nyaa/views/account.py
@@ -90,7 +90,17 @@ def register():
user.last_login_ip = user.registration_ip
db.session.add(user)
db.session.commit()
- if models.RangeBan.is_rangebanned(user.registration_ip):
+
+ if app.config['RAID_MODE_LIMIT_REGISTER']:
+ flask.flash(flask.Markup(app.config['RAID_MODE_REGISTER_MESSAGE'] + ' '
+ 'Please ask a moderator to manually '
+ 'activate your account \'{}\'.'
+ .format(flask.url_for('site.help') + '#irchelp',
+ flask.url_for('users.view_user',
+ user_name=user.username),
+ user.username)), 'warning')
+
+ elif models.RangeBan.is_rangebanned(user.registration_ip):
flask.flash(flask.Markup('Your IP is blocked from creating new accounts. '
'Please ask a moderator to manually '
'activate your account \'{}\'.'