Allow existing users to voluntarily sign up for the contributor terms

Based on a patch from Frederik Ramm this change allows users to make a
voluntary decision to sign up for the new contributor terms.
This commit is contained in:
Tom Hughes 2010-08-10 18:08:11 +01:00
parent 2adcfc1a72
commit a99b516962
4 changed files with 63 additions and 13 deletions

View file

@ -19,9 +19,6 @@ class UserController < ApplicationController
cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete], :unless => STATUS == :database_offline
def terms
@title = t 'user.new.title'
@user = User.new(params[:user])
@legale = params[:legale] || OSM.IPToCountry(request.remote_ip) || DEFAULT_LEGALE
@text = OSM.legal_text_for_country(@legale)
@ -29,8 +26,19 @@ class UserController < ApplicationController
render :update do |page|
page.replace_html "contributorTerms", :partial => "terms"
end
elsif @user.invalid?
render :action => 'new'
else
@title = t 'user.terms.title'
@user = User.new(params[:user]) if params[:user]
if @user
if @user.invalid?
render :action => :new
elsif @user.terms_agreed?
redirect_to :action => :account, :display_name => @user.display_name
end
else
redirect_to :action => :login, :referer => request.request_uri
end
end
end
@ -41,6 +49,16 @@ class UserController < ApplicationController
render :action => 'new'
elsif params[:decline]
redirect_to t('user.terms.declined')
elsif @user
if !@user.terms_agreed?
@user.consider_pd = params[:user][:consider_pd]
@user.terms_agreed = Time.now.getutc
if @user.save
flash[:notice] = t 'user.new.terms accepted'
end
end
redirect_to :action => :account, :display_name => @user.display_name
else
@user = User.new(params[:user])

View file

@ -38,6 +38,24 @@
</td>
</tr>
<tr>
<td class="fieldName" valign="top"><%= t 'user.account.contributor terms.heading' %></td>
<td>
<% if @user.terms_agreed? %>
<%= t 'user.account.contributor terms.agreed' %>
<span class="minorNote">(<a href="<%= t 'user.account.contributor terms.link' %>" target="_new"><%= t 'user.account.contributor terms.link text' %></a>)</span>
<br />
<% if @user.consider_pd? %>
<%= t 'user.account.contributor terms.agreed_with_pd' %>
<% end %>
<% else %>
<%= t 'user.account.contributor terms.not yet agreed' %> <br />
<%= link_to t('user.account.contributor terms.review link text'), :controller => 'user', :action => 'terms' %>
<% end %>
</td>
</tr>
<tr>
<td class="fieldName" valign="top"><%= t 'user.account.profile description' %></td>
<td><%= f.text_area :description, :rows => '5', :cols => '60' %></td>

View file

@ -1,6 +1,6 @@
<h1><%= t 'user.terms.heading' %></h1>
<p><%= t 'user.terms.press accept button' %></p>
<p><%= t 'user.terms.read and accept' %></p>
<!-- legale is <%= @legale %> -->
<% form_tag :action => 'terms' do %>
@ -33,13 +33,17 @@
</p>
<p>
<%= hidden_field_tag('referer', h(params[:referer])) unless params[:referer].nil? %>
<%= hidden_field('user', 'email') %>
<%= hidden_field('user', 'email_confirmation') %>
<%= hidden_field('user', 'display_name') %>
<%= hidden_field('user', 'pass_crypt') %>
<%= hidden_field('user', 'pass_crypt_confirmation') %>
<% if params[:user] %>
<%= hidden_field('user', 'email') %>
<%= hidden_field('user', 'email_confirmation') %>
<%= hidden_field('user', 'display_name') %>
<%= hidden_field('user', 'pass_crypt') %>
<%= hidden_field('user', 'pass_crypt_confirmation') %>
<% end %>
<div id="buttons">
<%= submit_tag(t('user.terms.decline'), :name => "decline", :id => "decline") %>
<% if params[:user] %>
<%= submit_tag(t('user.terms.decline'), :name => "decline", :id => "decline") %>
<% end %>
<%= submit_tag(t('user.terms.agree'), :name => "agree", :id => "agree") %>
</div>
</p>

View file

@ -1534,9 +1534,11 @@ en:
confirm password: "Confirm Password:"
continue: Continue
flash create success message: "User was successfully created. Check your email for a confirmation note, and you will be mapping in no time :-)<br /><br />Please note that you will not be able to login until you've received and confirmed your email address.<br /><br />If you use an antispam system which sends confirmation requests then please make sure you whitelist webmaster@openstreetmap.org as we are unable to reply to any confirmation requests."
terms accepted: "Thanks for accepting the new contributor terms!"
terms:
title: "Contributor terms"
heading: "Contributor terms"
press accept button: "Please read the agreement below and press the agree button to create your account."
read and accept: "Please read the agreement below and press the agree button to confirm that you accept the terms of the agreement."
consider_pd: "In addition to the above agreement, I consider my contributions to be in the Public Domain"
consider_pd_why: "what's this?"
consider_pd_why_url: http://wiki.openstreetmap.org/wiki/Why_would_I_want_my_contributions_to_be_public_domain
@ -1622,6 +1624,14 @@ en:
public editing note:
heading: "Public editing"
text: "Currently your edits are anonymous and people cannot send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below. <b>Since the 0.6 API changeover, only public users can edit map data</b>. (<a href=\"http://wiki.openstreetmap.org/wiki/Anonymous_edits\">find out why</a>).<ul><li>Your email address will not be revealed by becoming public.</li><li>This action cannot be reversed and all new users are now public by default.</li></ul>"
contributor terms:
heading: "Contributor Terms:"
agreed: "You have agreed to the new Contributor Terms."
not yet agreed: "You have not yet agreed to the new Contributor Terms."
review link text: "Please follow this link at your convenience to review and accept the new Contributor Terms."
agreed_with_pd: "You have also declared that you consider your edits to be in the Public Domain."
link: "http://www.osmfoundation.org/wiki/License/Contributor_Terms"
link text: "what is this?"
profile description: "Profile Description:"
preferred languages: "Preferred Languages:"
image: "Image:"