add DMCA contact form

This commit is contained in:
Kyle Drake 2015-03-24 14:44:22 -07:00
parent dd4318505f
commit a3fb4bd2c5
3 changed files with 123 additions and 0 deletions

35
app/dmca.rb Normal file
View file

@ -0,0 +1,35 @@
get '/dmca' do
erb :'dmca'
end
get '/dmca/contact_info' do
content_type :json
{data: erb(:'dmca/contact_info', layout: false)}.to_json
end
post '/dmca/contact' do
@errors = []
if params[:email].empty? || params[:subject].empty? || params[:urls].empty? || params[:body].empty?
@errors << 'Please fill out all fields'
end
if !recaptcha_valid?
@errors << 'Captcha was not filled out (or was filled out incorrectly)'
end
if !@errors.empty?
erb :'dmca'
else
EmailWorker.perform_async({
from: 'web@neocities.org',
reply_to: params[:email],
to: 'dmca@neocities.org',
subject: "[Neocities DMCA Notice]: #{params[:subject]}",
body: "#{params[:urls].to_s}\n#{params[:body].to_s}"
})
flash[:success] = 'Your DCMA notification has been sent.'
redirect '/'
end
end

69
views/dmca.erb Normal file
View file

@ -0,0 +1,69 @@
<script>
var RecaptchaOptions = {
theme : 'clean'
};
</script>
<div class="header-Outro">
<div class="row content single-Col">
<h1>DMCA Takedown Contact</h1>
</div>
</div>
<div class="content single-Col misc-page">
<% if !@errors.nil? && !@errors.empty? %>
<div class="alert alert-block alert-error">
<% @errors.each do |error| %>
<p><%= error%></p>
<% end %>
</div>
<% end %>
<h2>Submit a DMCA copyright takedown notice</h2>
<p>
If you believe your copyright-protected work is being hosted on Neocities without authorization, you may submit a copyright infringement notification. <strong>These requests should only be submitted by the copyright owner or an agent authorized to act on the owners behalf.</strong>
</p>
<div class="alert">
<strong>Do not make false claims. Misuse of this process may result in the suspension of your account or other legal consequences.</strong>
</div>
<p>
The fastest and simplest way to notify Neocities of alleged copyright infringement is via this contact form. You can choose to email, phone, fax, or mail us with the contact information displayed after this form, but please note that they will take us much longer to get to than using the form.
</p>
<h2>Submit a copyright complaint</h2>
<form action="/dmca/contact" method="POST" class="content">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
<fieldset>
<label for="your_email">Email address</label>
<input type="email" id="your_email" name="email" placeholder="me@example.com" class="col-50" value="<%= params[:email] %>">
<label for="email_subject">Subject</label>
<input type="text" id="email_subject" name="subject" placeholder="Subject" class="col-50" value="<%= params[:subject] %>">
<label for="urls">URLs of copyrighted content, enter one per line</label>
<textarea name="urls" id="urls" class="col-80" rows="3"><%= params[:urls] %></textarea>
<label for="your_comments">Text of Notice</label>
<textarea name="body" id="your_comments" class="col-80" rows="10"><%= params[:body] %></textarea>
<label>Fill out the captcha so we know youre not a robot:</label>
<div class="recaptcha">
<%== recaptcha_tag :challenge, ssl: request.ssl? %>
</div>
<input class="btn-Action" type="submit" value="Send">
</fieldset>
</form>
<div id="contactInfo"></div>
</div>
<script>
$.get('/dmca/contact_info', function(res) {
$('#contactInfo').html(res.data)
})
</script>

View file

@ -0,0 +1,19 @@
<h2>Alternate Contact Information</h2>
<h3>Mailing Address</h3>
<p>
Neocities
<br>
ATTN: DMCA
<br>
818 SW 3rd Avenue #221-2147
<br>
Portland, OR 97204-2405
</p>
<h3>Phone</h3>
<p>
1-503-395-0010
</p>
<h3>Fax</h3>
<p>
1-541-238-9273
</p>