diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index e22a4992a..01e62ccc3 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -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])
diff --git a/app/views/user/account.html.erb b/app/views/user/account.html.erb
index 85e9aebef..d5bcb3821 100644
--- a/app/views/user/account.html.erb
+++ b/app/views/user/account.html.erb
@@ -38,6 +38,24 @@
+
+ <%= t 'user.account.contributor terms.heading' %> |
+
+ <% if @user.terms_agreed? %>
+ <%= t 'user.account.contributor terms.agreed' %>
+ (<%= t 'user.account.contributor terms.link text' %>)
+
+ <% if @user.consider_pd? %>
+ <%= t 'user.account.contributor terms.agreed_with_pd' %>
+ <% end %>
+ <% else %>
+ <%= t 'user.account.contributor terms.not yet agreed' %>
+
+ <%= link_to t('user.account.contributor terms.review link text'), :controller => 'user', :action => 'terms' %>
+ <% end %>
+ |
+
+
<%= t 'user.account.profile description' %> |
<%= f.text_area :description, :rows => '5', :cols => '60' %> |
diff --git a/app/views/user/terms.html.erb b/app/views/user/terms.html.erb
index 049e07ca7..2ab2c7ebd 100644
--- a/app/views/user/terms.html.erb
+++ b/app/views/user/terms.html.erb
@@ -1,6 +1,6 @@
<%= t 'user.terms.heading' %>
-<%= t 'user.terms.press accept button' %>
+<%= t 'user.terms.read and accept' %>
<% form_tag :action => 'terms' do %>
@@ -33,13 +33,17 @@
<%= 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 %>
- <%= 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") %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 61616c562..4fbe1b20b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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 :-)
Please note that you will not be able to login until you've received and confirmed your email address.
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. Since the 0.6 API changeover, only public users can edit map data. (find out why).- Your email address will not be revealed by becoming public.
- This action cannot be reversed and all new users are now public by default.
"
+ 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:"