if request.xhr?
render :update do |page|
- page.replace_html "contributorTerms", :partial => "terms"
+ page.replace_html "contributorTerms", :partial => "terms", :locals => { :has_decline => params[:has_decline] }
+ end
++ elsif using_open_id?
++ # The redirect from the OpenID provider reenters here
++ # again and we need to pass the parameters through to
++ # the open_id_authentication function
++ @user = session.delete(:new_user)
++
++ openid_verify(nil, @user) do |user|
+ end
- elsif params[:user]
++
++ if @user.openid_url.nil? or @user.invalid?
++ render :action => 'new'
++ else
++ render :action => 'terms'
++ end
+ else
+ session[:referer] = params[:referer]
+
- @user = User.new(params[:user])
+ @title = t 'user.terms.title'
+ @user = User.new(params[:user]) if params[:user]
- if @user.valid?
- if params[:user][:openid_url].nil? or
- params[:user][:openid_url].empty?
- # No OpenID so just move on to the terms
- render :action => 'terms'
- else
+ if params[:user][:openid_url] and @user.pass_crypt.empty?
+ # We are creating an account with OpenID and no password
+ # was specified so create a random one
+ @user.pass_crypt = ActiveSupport::SecureRandom.base64(16)
+ @user.pass_crypt_confirmation = @user.pass_crypt
+ end
+
+ if @user
+ if @user.invalid?
++ # Something is wrong, so rerender the form
+ render :action => :new
+ elsif @user.terms_agreed?
++ # Already agreed to terms, so just show settings
+ redirect_to :action => :account, :display_name => @user.display_name
++ elsif params[:user][:openid_url]
+ # Verify OpenID before moving on
+ session[:new_user] = @user
+ openid_verify(params[:user][:openid_url], @user)
end
else
- # Something is wrong, so rerender the form
- render :action => 'new'
- end
- elsif using_open_id?
- # The redirect from the OpenID provider reenters here
- # again and we need to pass the parameters through to
- # the open_id_authentication function
- @user = session.delete(:new_user)
-
- openid_verify(nil, @user) do |user|
- end
-
- if @user.openid_url.nil? or @user.invalid?
- render :action => 'new'
- else
- render :action => 'terms'
++ # Not logged in, so redirect to the login page
+ redirect_to :action => :login, :referer => request.request_uri
end
end
end
end
def login
- @title = t 'user.login.title'
-
- if params[:user]
- email_or_display_name = params[:user][:email]
- pass = params[:user][:password]
- user = User.authenticate(:username => email_or_display_name, :password => pass)
+ if params[:username] or using_open_id?
+ session[:remember_me] ||= params[:remember_me]
+ session[:referer] ||= params[:referer]
- if user
- session[:user] = user.id
- session_expires_after 1.month if params[:remember_me]
-
- # The user is logged in, if the referer param exists, redirect
- # them to that unless they've also got a block on them, in
- # which case redirect them to the block so they can clear it.
- if user.blocked_on_view
- redirect_to user.blocked_on_view, :referer => params[:referer]
- elsif params[:referer]
- redirect_to params[:referer]
- else
- redirect_to :controller => 'site', :action => 'index'
- end
- elsif User.authenticate(:username => email_or_display_name, :password => pass, :pending => true)
- flash.now[:error] = t 'user.login.account not active'
- elsif User.authenticate(:username => email_or_display_name, :password => pass, :suspended => true)
- webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org"
- flash.now[:error] = t 'user.login.account suspended', :webmaster => webmaster
+ if using_open_id?
+ openid_authentication(params[:openid_url])
else
- flash.now[:error] = t 'user.login.auth failure'
+ password_authentication(params[:username], params[:password])
end
else
- @title = t 'user.login.title'
+ flash.now[:notice] = t 'user.login.notice'
end
end
</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') %>
- <%= hidden_field('user', 'openid_url') %>
+ <% 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') %>
++ <%= hidden_field('user', 'openid_url') %>
+ <% 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>
account suspended: Sorry, your account has been suspended due to suspicious activity.<br />Please contact the {{webmaster}} if you wish to discuss this.
webmaster: webmaster
auth failure: "Sorry, could not log in with those details."
+ notice: "<a href=\"http://www.osmfoundation.org/wiki/License/We_Are_Changing_The_License\">Find out more about OpenStreetMap's upcoming license change</a> (<a href=\"http://wiki.openstreetmap.org/wiki/ODbL/We_Are_Changing_The_License\">translations</a>) (<a href=\"http://wiki.openstreetmap.org/wiki/Talk:ODbL/Upcoming\">discussion</a>)"
+ openid missing provider: "Sorry, could not contact your OpenID provider"
+ openid invalid: "Sorry, your OpenID seems to be malformed"
+ openid_logo_alt: "Log in with an OpenID"
+ openid_providers:
+ openid:
+ title: Login with an OpenID URL
+ alt: Login with an OpenID URL
+ yahoo:
+ title: Login with a Yahoo! OpenID
+ alt: Login with a Yahoo! OpenID
+ google:
+ title: Login with a Google OpenID
+ alt: Login with a Google OpenID
+ myopenid:
+ title: Login with a myOpenID OpenID
+ alt: Login with a myOpenID OpenID
+ wordpress:
+ title: Login with a Wordpress.com OpenID
+ alt: Login with a Wordpress.com OpenID
+ myspace:
+ title: Login with a MySpace OpenID
+ alt: Login with a MySpace OpenID
logout:
title: "Logout"
heading: "Logout from OpenStreetMap"
not displayed publicly: 'Not displayed publicly (see <a href="http://wiki.openstreetmap.org/wiki/Privacy_Policy" title="wiki privacy policy including section on email addresses">privacy policy</a>)'
display name: "Display Name:"
display name description: "Your publicly displayed username. You can change this later in the preferences."
+ openid: "{{logo}} OpenID:"
password: "Password:"
confirm password: "Confirm Password:"
+ use openid: "Alternatively, use {{logo}} OpenID to login"
+ openid no password: "With OpenID a password is not required, but some extra tools or server may still need one."
+ openid association: |
+ <p>Your OpenID is not associated with a OpenStreetMap account yet.</p>
+ <ul>
+ <li>If you are new to OpenStreetMap, please create a new account using the form below.</li>
+ <li>
+ If you already have an account, you can login to your account
+ using your username and password and then associate the account
+ with your OpenID in your user settings.
+ </li>
+ </ul>
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 this agreement for your existing and future contributions."
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
+ consider_pd_why_url: http://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
agree: Agree
declined: "http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
decline: "Decline"