From: Tom Hughes Date: Sat, 21 May 2011 11:14:56 +0000 (+0100) Subject: Merge branch 'master' into openid X-Git-Tag: live~6879 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/832b96b75ac05177e6baad7b414066ccfd7cfa51?ds=inline;hp=-c Merge branch 'master' into openid Conflicts: app/controllers/user_controller.rb app/views/user/terms.html.erb test/fixtures/users.yml --- 832b96b75ac05177e6baad7b414066ccfd7cfa51 diff --combined app/controllers/user_controller.rb index 1193ec910,97b0de73c..a066c1c63 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@@ -1,6 -1,7 +1,7 @@@ class UserController < ApplicationController - layout 'site', :except => :api_details + layout :choose_layout + before_filter :disable_terms_redirect, :only => [:terms, :save, :logout, :api_details] before_filter :authorize, :only => [:api_details, :api_gpx_files] before_filter :authorize_web, :except => [:api_details, :api_gpx_files] before_filter :set_locale, :except => [:api_details, :api_gpx_files] @@@ -24,55 -25,24 +25,55 @@@ if request.xhr? render :update do |page| - page.replace_html "contributorTerms", :partial => "terms", :locals => { :has_decline => params[:has_decline] } + page.replace_html "contributorTerms", :partial => "terms" 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' + end else + session[:referer] = params[:referer] + @title = t 'user.terms.title' @user = User.new(params[:user]) if params[:user] + if params[:user] and 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? if @user.new_record? + # Something is wrong with a new user, so rerender the form render :action => :new else + # Error in existing user, so go to account settings flash[:errors] = @user.errors redirect_to :action => :account, :display_name => @user.display_name end elsif @user.terms_agreed? + # Already agreed to terms, so just show settings redirect_to :action => :account, :display_name => @user.display_name + elsif params[:user] and params[:user][:openid_url] + # Verify OpenID before moving on + session[:new_user] = @user + openid_verify(params[:user][:openid_url], @user) end else + # Not logged in, so redirect to the login page redirect_to :action => :login, :referer => request.request_uri end end @@@ -84,17 -54,36 +85,36 @@@ if Acl.find_by_address(request.remote_ip, :conditions => {:k => "no_account_creation"}) render :action => 'new' elsif params[:decline] - redirect_to t('user.terms.declined') + if @user + @user.terms_seen = true + + if @user.save + flash[:notice] = t 'user.new.terms declined', :url => t('user.new.terms declined url') + end + + if params[:referer] + redirect_to params[:referer] + else + redirect_to :action => :account, :display_name => @user.display_name + end + else + redirect_to t('user.terms.declined') + end elsif @user if !@user.terms_agreed? @user.consider_pd = params[:user][:consider_pd] @user.terms_agreed = Time.now.getutc + @user.terms_seen = true if @user.save flash[:notice] = t 'user.new.terms accepted' end end - redirect_to :action => :account, :display_name => @user.display_name + if params[:referer] + redirect_to params[:referer] + else + redirect_to :action => :account, :display_name => @user.display_name + end else @user = User.new(params[:user]) @@@ -104,14 -93,15 +124,15 @@@ @user.creation_ip = request.remote_ip @user.languages = request.user_preferred_languages @user.terms_agreed = Time.now.getutc - + @user.terms_seen = true + if @user.save flash[:notice] = t 'user.new.flash create success message', :email => @user.email - Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => params[:referer])) + Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer))) session[:token] = @user.tokens.create.token - redirect_to :action => 'login' + redirect_to :action => 'login', :referer => params[:referer] else - render :action => 'new' + render :action => 'new', :referer => params[:referer] end end end @@@ -146,25 -136,22 +167,25 @@@ @user.preferred_editor = params[:user][:preferred_editor] end - if @user.save - set_locale - - if @user.new_email.nil? or @user.new_email.empty? - flash[:notice] = t 'user.account.flash update success' - else - flash[:notice] = t 'user.account.flash update success confirm needed' + @user.openid_url = nil if params[:user][:openid_url].empty? - begin - Notifier.deliver_email_confirm(@user, @user.tokens.create) - rescue - # Ignore errors sending email - end - end - - redirect_to :action => "account", :display_name => @user.display_name + if params[:user][:openid_url].length > 0 and + params[:user][:openid_url] != @user.openid_url + # If the OpenID has changed, we want to check that it is a + # valid OpenID and one the user has control over before saving + # it as a password equivalent for the user. + session[:new_user] = @user + openid_verify(params[:user][:openid_url], @user) + else + update_user(@user) + 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| + update_user(user) end else if flash[:errors] @@@ -230,26 -217,46 +251,26 @@@ def new @title = t 'user.new.title' - - # The user is logged in already, so don't show them the signup - # page, instead send them to the home page - redirect_to :controller => 'site', :action => 'index' if session[:user] + @referer = params[:referer] || session[:referer] + + if session[:user] + # The user is logged in already, so don't show them the signup + # page, instead send them to the home page + redirect_to :controller => 'site', :action => 'index' + elsif not params['openid'].nil? + flash.now[:notice] = t 'user.new.openid association' + end end def login - @title = t 'user.login.title' + if params[:username] or using_open_id? + session[:remember_me] ||= params[:remember_me] + session[:referer] ||= params[:referer] - 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 user - session[:user] = user.id - session_expires_after 1.month if params[:remember_me] - - target = params[:referer] || url_for(:controller => :site, :action => :index) - - # The user is logged in, so decide where to send them: - # - # - If they haven't seen the contributor terms, send them there. - # - If they have a block on them, show them that. - # - If they were referred to the login, send them back there. - # - Otherwise, send them to the home page. - if REQUIRE_TERMS_SEEN and not user.terms_seen - redirect_to :controller => :user, :action => :terms, :referer => target - elsif user.blocked_on_view - redirect_to user.blocked_on_view, :referer => target - else - redirect_to target - end - elsif user = User.authenticate(:username => email_or_display_name, :password => pass, :pending => true) - flash.now[:error] = t 'user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name) - 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 elsif flash[:notice].nil? flash.now[:notice] = t 'user.login.notice' @@@ -469,164 -476,6 +490,171 @@@ private + ## + # handle password authentication + def password_authentication(username, password) + if user = User.authenticate(:username => username, :password => password) + successful_login(user) + elsif user = User.authenticate(:username => username, :password => password, :pending => true) + failed_login t('user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name)) + elsif User.authenticate(:username => username, :password => password, :suspended => true) + webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org" + failed_login t('user.login.account suspended', :webmaster => webmaster) + else + failed_login t('user.login.auth failure') + end + end + + ## + # handle OpenID authentication + def openid_authentication(openid_url) + # If we don't appear to have a user for this URL then ask the + # provider for some extra information to help with signup + if openid_url and User.find_by_openid_url(openid_url) + required = nil + else + required = [:nickname, :email, "http://axschema.org/namePerson/friendly", "http://axschema.org/contact/email"] + end + + # Start the authentication + authenticate_with_open_id(openid_expand_url(openid_url), :required => required) do |result, identity_url, sreg, ax| + if result.successful? + # We need to use the openid url passed back from the OpenID provider + # rather than the one supplied by the user, as these can be different. + # + # For example, you can simply enter yahoo.com in the login box rather + # than a user specific url. Only once it comes back from the provider + # provider do we know the unique address for the user. + if user = User.find_by_openid_url(identity_url) + case user.status + when "pending" then + failed_login t('user.login.account not active') + when "active", "confirmed" then + successful_login(user) + when "suspended" then + webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org" + failed_login t('user.login.account suspended', :webmaster => webmaster) + else + failed_login t('user.login.auth failure') + end + else + # We don't have a user registered to this OpenID, so redirect + # to the create account page with username and email filled + # in if they have been given by the OpenID provider through + # the simple registration protocol. + nickname = sreg["nickname"] || ax["http://axschema.org/namePerson/friendly"] + email = sreg["email"] || ax["http://axschema.org/contact/email"] + redirect_to :controller => 'user', :action => 'new', :nickname => nickname, :email => email, :openid => identity_url + end + elsif result.missing? + failed_login t('user.login.openid missing provider') + elsif result.invalid? + failed_login t('user.login.openid invalid') + else + failed_login t('user.login.auth failure') + end + end + end + + ## + # verify an OpenID URL + def openid_verify(openid_url, user) + user.openid_url = openid_url + + authenticate_with_open_id(openid_expand_url(openid_url)) do |result, identity_url| + if result.successful? + # We need to use the openid url passed back from the OpenID provider + # rather than the one supplied by the user, as these can be different. + # + # For example, you can simply enter yahoo.com in the login box rather + # than a user specific url. Only once it comes back from the provider + # provider do we know the unique address for the user. + user.openid_url = identity_url + yield user + elsif result.missing? + flash.now[:error] = t 'user.login.openid missing provider' + elsif result.invalid? + flash.now[:error] = t 'user.login.openid invalid' + else + flash.now[:error] = t 'user.login.auth failure' + end + end + end + + ## + # special case some common OpenID providers by applying heuristics to + # try and come up with the correct URL based on what the user entered + def openid_expand_url(openid_url) + if openid_url.nil? + return nil + elsif openid_url.match(/(.*)gmail.com(\/?)$/) or openid_url.match(/(.*)googlemail.com(\/?)$/) + # Special case gmail.com as it is potentially a popular OpenID + # provider and, unlike yahoo.com, where it works automatically, Google + # have hidden their OpenID endpoint somewhere obscure this making it + # somewhat less user friendly. + return 'https://www.google.com/accounts/o8/id' + else + return openid_url + end + end + + ## + # process a successful login + def successful_login(user) + session[:user] = user.id - + session_expires_after 1.month if session[:remember_me] + - if user.blocked_on_view - redirect_to user.blocked_on_view, :referer => params[:referer] - elsif session[:referer] - redirect_to session[:referer] ++ target = params[:referer] || url_for(:controller => :site, :action => :index) ++ ++ # The user is logged in, so decide where to send them: ++ # ++ # - If they haven't seen the contributor terms, send them there. ++ # - If they have a block on them, show them that. ++ # - If they were referred to the login, send them back there. ++ # - Otherwise, send them to the home page. ++ if REQUIRE_TERMS_SEEN and not user.terms_seen ++ redirect_to :controller => :user, :action => :terms, :referer => target ++ elsif user.blocked_on_view ++ redirect_to user.blocked_on_view, :referer => target + else - redirect_to :controller => 'site', :action => 'index' ++ redirect_to target + end + + session.delete(:remember_me) + session.delete(:referer) + end + + ## + # process a failed login + def failed_login(message) + flash[:error] = message + + redirect_to :action => 'login', :referer => session[:referer] + + session.delete(:remember_me) + session.delete(:referer) + end + + ## + # update a user's details + def update_user(user) + if user.save + set_locale + + if user.new_email.nil? or user.new_email.empty? + flash.now[:notice] = t 'user.account.flash update success' + else + flash.now[:notice] = t 'user.account.flash update success confirm needed' + + begin + Notifier.deliver_email_confirm(user, user.tokens.create) + rescue + # Ignore errors sending email + end + end + end + end + ## # require that the user is a administrator, or fill out a helpful error message # and return them to the user page. @@@ -651,4 -500,28 +679,28 @@@ rescue ActiveRecord::RecordNotFound redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name] unless @this_user end + + ## + # Choose the layout to use. See + # https://rails.lighthouseapp.com/projects/8994/tickets/5371-layout-with-onlyexcept-options-makes-other-actions-render-without-layouts + def choose_layout + oauth_url = url_for(:controller => :oauth, :action => :oauthorize, :only_path => true) + + if [ 'api_details' ].include? action_name + nil + elsif params[:referer] and URI.parse(params[:referer]).path == oauth_url + 'slim' + else + 'site' + end + end + + ## + # + def disable_terms_redirect + # this is necessary otherwise going to the user terms page, when + # having not agreed already would cause an infinite redirect loop. + # it's .now so that this doesn't propagate to other pages. + flash.now[:skip_terms] = true + end end diff --combined app/views/user/account.html.erb index 161f8f4f9,abece879f..16f3ad7d3 --- a/app/views/user/account.html.erb +++ b/app/views/user/account.html.erb @@@ -27,11 -27,6 +27,11 @@@ <%= f.password_field :pass_crypt_confirmation, {:value => '', :size => 30, :maxlength => 255, :autocomplete => :off} %> + + <%= t 'user.account.openid.openid' %> + <%= f.text_field :openid_url, {:class => "openid_url"} %> (<%= t 'user.account.openid.link text' %>) + + <%= t 'user.account.public editing.heading' %> @@@ -106,7 -101,7 +106,7 @@@ class="nohome" <%end%> > <%= t 'user.account.home location' %> - <%= t 'user.account.no home location' %><%= t 'user.account.latitude' %> <%= f.text_field :home_lat, :size => 20, :id => "home_lat" %><%= t 'user.account.longitude' %><%= f.text_field :home_lon, :size => 20, :id => "home_lon" %> + <%= t 'user.account.no home location' %><%= t 'user.account.latitude' %> <%= f.text_field :home_lat, :size => 20, :id => "home_lat" %> <%= t 'user.account.longitude' %><%= f.text_field :home_lon, :size => 20, :id => "home_lon" %> @@@ -124,7 -119,7 +124,7 @@@ <% end %> - <%= render :partial => 'map' %> + <%= render :partial => 'map', :locals => { :setting_location => true, :show_other_users => false } %> <% unless @user.data_public? %> diff --combined app/views/user/terms.html.erb index 3e93ff20c,5160716d1..ded9b4db6 --- a/app/views/user/terms.html.erb +++ b/app/views/user/terms.html.erb @@@ -13,7 -13,7 +13,7 @@@ :before => update_page do |page| page.replace_html 'contributorTerms', image_tag('searching.gif') end, - :url => {:legale => legale, :has_decline => @user.new_record?} + :url => {:legale => legale} ) %> <%= label_tag "legale_#{legale}", t('user.terms.legale_names.' + name) %> @@@ -22,7 -22,7 +22,7 @@@ <% end %>
- <%= render :partial => "terms", :locals => { :has_decline => @user.new_record? } %> + <%= render :partial => "terms" %>
<% form_tag({:action => "save"}, { :id => "termsForm" }) do %> @@@ -33,18 -33,15 +33,16 @@@

<%= hidden_field_tag('referer', h(params[:referer])) unless params[:referer].nil? %> - <% if params[:user] %> + <% if @user.new_record? %> <%= 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 %>

- <% if @user.new_record? %> - <%= submit_tag(t('user.terms.decline'), :name => "decline", :id => "decline") %> - <% end %> + <%= submit_tag(t('user.terms.decline'), :name => "decline", :id => "decline") %> <%= submit_tag(t('user.terms.agree'), :name => "agree", :id => "agree") %>

diff --combined config/locales/en.yml index 1fa2831ea,8fb884914..1509ba917 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -141,6 -141,8 +141,8 @@@ en common_details: edited_at: "Edited at:" edited_by: "Edited by:" + deleted_at: "Deleted at:" + deleted_by: "Deleted by:" version: "Version:" in_changeset: "In changeset:" changeset_comment: "Comment:" @@@ -219,6 -221,8 +221,8 @@@ zoom_or_select: "Zoom in or select an area of the map to view" drag_a_box: "Drag a box on the map to select an area" manually_select: "Manually select a different area" + hide_areas: "Hide areas" + show_areas: "Show areas" loaded_an_area_with_num_features: "You have loaded an area which contains [[num_features]] features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below." load_data: "Load Data" unable_to_load_size: "Unable to load: Bounding box size of [[bbox_size]] is too large (must be smaller than {{max_bbox_size}})" @@@ -950,6 -954,7 +954,7 @@@ community_blogs_title: "Blogs from members of the OpenStreetMap community" foundation: Foundation foundation_title: The OpenStreetMap Foundation + sotm2011: 'Come to the 2011 OpenStreetMap Conference, The State of the Map, September 9-11th in Denver!' license: alt: CC by-sa 2.0 title: OpenStreetMap data is licensed under the Creative Commons Attribution-Share Alike 2.0 Generic License @@@ -1056,6 -1061,8 +1061,8 @@@ Resources Canada), CanVec (© Department of Natural Resources Canada), and StatCan (Geography Division, Statistics Canada). +
  • France: Contains data sourced from + Direction Générale des Impôts.
  • New Zealand: Contains data sourced from Land Information New Zealand. Crown Copyright reserved.
  • Poland: Contains data from download Flash Player from Adobe.com. Several other options are also available for editing OpenStreetMap.' potlatch_unsaved_changes: "You have unsaved changes. (To save in Potlatch, you should deselect the current way or point, if editing in live mode, or click save if you have a save button.)" + potlatch2_not_configured: "Potlatch 2 has not been configured - please see http://wiki.openstreetmap.org/wiki/The_Rails_Port#Potlatch_2 for more information" potlatch2_unsaved_changes: "You have unsaved changes. (To save in Potlatch 2, you should click save.)" no_iframe_support: "Your browser doesn't support HTML iframes, which are necessary for this feature." sidebar: @@@ -1372,10 -1380,9 +1380,9 @@@ help: "Help" help_url: "http://wiki.openstreetmap.org/wiki/Upload" trace_header: - your_traces: "See just your traces" upload_trace: "Upload a trace" see_all_traces: "See all traces" - see_your_traces: "See all your traces" + see_your_traces: "See your traces" traces_waiting: "You have {{count}} traces waiting for upload. Please consider waiting for these to finish before uploading any more, so as not to block the queue for other users." trace_optionals: tags: "Tags" @@@ -1437,6 -1444,7 +1444,7 @@@ cookies_needed: "You appear to have cookies disabled - please enable cookies in your browser before continuing." setup_user_auth: blocked: "Your access to the API has been blocked. Please log-in to the web interface to find out more." + need_to_see_terms: "Your access to the API is temporarily suspended. Please log-in to the web interface to view the Contributor Terms. You do not need to agree, but you must view them." oauth: oauthorize: request_access: "The application {{app_name}} is requesting access to your account. Please check whether you would like the application to have the following capabilities. You may choose as many or as few as you like." @@@ -1508,15 -1516,15 +1516,15 @@@ login: title: "Login" heading: "Login" - please login: "Please login or {{create_user_link}}." - create_account: "create an account" email or username: "Email Address or Username:" password: "Password:" + openid: "{{logo}} OpenID:" remember: "Remember me:" lost password link: "Lost your password?" login_button: "Login" register now: Register now - already have: Already have an OpenStreetMap account? Please login. + with username: "Already have an OpenStreetMap account? Please login with your username and password:" + with openid: "Alternatively please use your OpenID to login:" new to osm: New to OpenStreetMap? to make changes: To make changes to the OpenStreetMap data, you must have an account. create account minute: Create an account. It only takes a minute. @@@ -1525,28 -1533,6 +1533,28 @@@ webmaster: webmaster auth failure: "Sorry, could not log in with those details." notice: "Find out more about OpenStreetMap's upcoming license change (translations) (discussion)" + 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" @@@ -1579,24 -1565,13 +1587,26 @@@ not displayed publicly: 'Not displayed publicly (see privacy policy)' 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: | +

    Your OpenID is not associated with a OpenStreetMap account yet.

    + continue: Continue flash create success message: "Thanks for signing up. We've sent a confirmation note to {{email}} and as soon as you confirm your account you'll be able to get mapping.

    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 declined: "We are sorry that you have decided to not accept the new Contributor Terms. For more information, please see this wiki page." + terms declined url: http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined terms: title: "Contributor terms" heading: "Contributor terms" @@@ -1607,6 -1582,7 +1617,7 @@@ agree: Agree declined: "http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined" decline: "Decline" + you need to accept or decline: "Please read and then either accept or decline the new Contributor Terms to continue." legale_select: "Please select your country of residence:" legale_names: france: "France" @@@ -1677,10 -1653,6 +1688,10 @@@ current email address: "Current Email Address:" new email address: "New Email Address:" email never displayed publicly: "(never displayed publicly)" + openid: + openid: "OpenID:" + link: "http://wiki.openstreetmap.org/wiki/OpenID" + link text: "what is this?" public editing: heading: "Public editing:" enabled: "Enabled. Not anonymous and can edit data." diff --combined config/locales/is.yml index be2f08452,bf033ac8a..505973def --- a/config/locales/is.yml +++ b/config/locales/is.yml @@@ -1,6 -1,6 +1,6 @@@ # Messages for Icelandic (Íslenska) # Exported from translatewiki.net - # Export driver: syck + # Export driver: syck-pecl # Author: Ævar Arnfjörð Bjarmason is: activerecord: @@@ -1011,8 -1011,6 +1011,8 @@@ current email address: "Núverandi netfang:" delete image: Eyða þessari mynd email never displayed publicly: (aldrei sýnt opinberlega) + openid: + link text: "hvað er openID?" flash update success: Stillingarnar þínar voru uppfærðar. flash update success confirm needed: Stillingarnar þínar voru uppfærðar. Póstur var sendur á netfangið þitt sem þú þarft að bregðast við til að netfangið þitt verði staðfest. home location: "Staðsetning:" @@@ -1072,28 -1070,6 +1072,28 @@@ remember: "Muna innskráninguna:" title: Innskrá webmaster: vefstjóra + openid_heading: "Innskráning með OpenID:" + username_heading: "Innskráning með OpenStreetMap aðgang:" + openid_logo_alt: "Innskrá með OpenID" + openid_providers: + openid: + title: Innskrá með OpenID slóð + alt: Innskrá með OpenID slóð + yahoo: + title: Innsrká með Yahoo! OpenID + alt: Innsrká með Yahoo! OpenID + google: + title: Innsrká með Google OpenID + alt: Innsrká með Google OpenID + myopenid: + title: Innsrká með myOpenID OpenID + alt: Innsrká með myOpenID OpenID + wordpress: + title: Innsrká með Wordpress.com OpenID + alt: Innsrká með Wordpress.com OpenID + myspace: + title: Innsrká með MySpace OpenID + alt: Innsrká með MySpace OpenID logout: heading: Útskrá logout_button: Útskrá @@@ -1125,21 -1101,6 +1125,21 @@@ no_auto_account_create: Því miður getum við eki búið til reikning fyrir þig sjálfkrafa. not displayed publicly: Ekki sýnt opinberlega (sjá meðferð persónuupplýsinga) password: "Lykilorð:" + openID associate: "Tengja OpenID við þennan aðgang" + openID: "OpenID:" + openID description: '(Valfrjálst) Ef þú ert með OpenID getur þú tengt það við nýja aðganginn þinn.' + openID nopassword: "Með OpenID þarft þú ekki að gefa upp lykilorð við innskráningu. Í stað þess notar þú OpenID." + openID association: | + Þetta OpenID er ekki tengt við neinn OpenStreetMap aðgang. + + signup: Nýskrá title: Nýskrá no_such_user: body: Það er ekki til notandi með nafninu {{user}}. Kannski slóstu nafnið rangt inn eða fylgdir ógildum tengli. diff --combined public/stylesheets/common.css index 3051f52d1,1ea7a5bd2..18c7917f3 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@@ -10,6 -10,10 +10,10 @@@ body padding: 0px; } + body.slim { + background-color: #f0f0f0; + } + /* Rules for links */ a { @@@ -63,6 -67,12 +67,12 @@@ hr margin: 0px; } + /* Rules for the site name */ + + #small-title { + display: none; + } + /* Rules for the introductory text displayed in the left sidebar to new users */ #intro { @@@ -167,8 -177,12 +177,12 @@@ /* Rules for SOTM advert */ #sotm { - width: 170px; + width: 180px; + min-width: 180px; + margin: 5px; padding: 0px; + border: 0px; + background: #fff; } /* @@@ -543,14 -557,57 +557,57 @@@ text-align: left; } + #slim_container { + width: 100%; + } + + #slim_container_content { + max-width: 50em; + background-color: #FFFFFF; + margin: 10px auto; + padding: 3px; + border-radius: 25px; + -moz-border-radius: 25px; + border: 1px solid #e6e6e6; + } + + #slim_content { + margin: 10px; + margin-top: 90px; + max-width: 50em; + } + + #slim_header { + margin: 10px; + position: absolute; + top: 0px; + } + + #slim_header img { + vertical-align: middle; + margin-right: 5px; + margin-bottom: 5px; + } + /* Rules for the changeset list shown by the history tab etc */ - #changeset_list, #keyvalue { - width: 100%; + #changeset_list_container { + position: relative; + } + + #changeset_list { + width: 50%; font-size: small; text-align: left; border-collapse: collapse; border-width: 0px; + margin-top: 1px; + margin-bottom: 1px; + } + + #changeset_list td { + vertical-align: top; + padding: 3px; } #changeset_list .date { @@@ -565,8 -622,20 +622,20 @@@ white-space: nowrap; } - #changeset_list.th { - font-weight: bold; + #changeset_list .selected { + background-color: rgb(255, 255, 160); + background-color: rgba(255, 255, 85, 0.5); + } + + #changeset_list_map { + float: right; + position: absolute; + top: 0px; + bottom: 0px; + right: 0px; + width: 49%; + min-height: 400px; + border: solid 1px black; } /* Rules for the data browser */ @@@ -578,6 -647,10 +647,10 @@@ margin-left: 10px; } + table.browse_details th { + white-space: nowrap; + } + #browse_map { float: right; width: 250px; @@@ -628,10 -701,6 +701,6 @@@ /* Rules for the login page */ - #login_wrapper { - float: left; /* ensures the child divs are the same size, and only as wide as they need to be */ - } - #login_wrapper div { margin: 5px; padding: 15px; @@@ -644,17 -713,16 +713,20 @@@ } #login_login { - background-color: #f0f0f0; + background-color: #f5f5ff; + border: 1px solid #f3f3ff; + border-radius: 15px; + -moz-border-radius: 15px; } #login_login h1 { margin-top: 5px; } +#login_openid_buttons img { + border: 0; +} + #login_signup form.button-to div { margin: 0px; padding: 0px; @@@ -667,7 -735,11 +739,11 @@@ div#contributorTerms padding: 4px; overflow: auto; width: 80%; - height: 60%; + height: 400px; + } + + div#slim_content div#contributorTerms { + width: auto; } div#contributorTerms p#first { @@@ -691,6 -763,11 +767,11 @@@ div#contributorTerms img form#termsForm { width: 80%; + margin-bottom: 3em; + } + + div#slim_content form#termsForm { + width: auto; } form#termsForm div#buttons { @@@ -842,11 -919,6 +923,11 @@@ input[type="submit"] border: 1px solid black; } +input.openid_url { + background: url('../images/openid_input.png') repeat-y left white; + padding-left: 16px; +} + /* Rules for user images */ img.user_image { @@@ -889,10 -961,3 +970,10 @@@ abbr.geo .table1 { background: #fff; } + +/* Rules for OpenID logo */ + +.openid_logo { + vertical-align: text-bottom; + border: 0; +} diff --combined public/stylesheets/small.css index c709bcba9,f4d51c868..76fea4fcc --- a/public/stylesheets/small.css +++ b/public/stylesheets/small.css @@@ -22,7 -22,7 +22,7 @@@ h1 { height: 14px; margin: 0px; - padding-left: 10px; + padding-left: 3px; padding-top: 5px; margin-top: 18px; background: url('../images/tab_bottom.gif') repeat-x bottom; @@@ -38,6 -38,32 +38,32 @@@ margin-right: 1px; } + /* Rules for the site name - shown when left sidebar is hidden */ + + #small-title { + font-size: 12px; + line-height: 14px; + height: 16px; + display: block; + position: absolute; + top: 0; + padding: 2px; + width: 110px; /* TODO: find better fix for overlap */ + background-color: #fff; + z-index: 100; + } + + #small-title img { + position: absolute; + } + + #small-title h1 { + position: absolute; + left: 18px; + font-size: 12px; + margin: 2px; + } + /* Rules for greeting bar in the top right corner */ #greeting { @@@ -100,21 -126,81 +126,90 @@@ /* Rules for the login form */ -#loginForm input#user_email { +.loginBox { + width: 90%; +} + +.loginBox input#user_email { + width: 100%; + max-width: 18em; +} + +.loginBox input#user_password { width: 100%; max-width: 18em; } -#loginForm input#user_password { +.loginBox input#user_openid_url { width: 100%; max-width: 18em; } + + /* Rules for the profile page */ + + .user_map { + width: 100% !important; + height: 300px !important; + } + + /* Rules for the user settings page */ + + #user_new_email { + width: 60% !important; + } + + #user_description, #user_preferred_editor { + width: 90% !important; + } + + .minorNote { + display: block; + } + + /* Rules for the browse pages */ + + #browse_navigation { + width: 100% !important; + margin-top: 0 !important; + } + + #small_map, #browse_map { + width: 100% !important; + } + + #changeset_list tr { + display: block; + clear: left; + width: 100%; + } + + #changeset_list th { + display: none; + } + + #changeset_list td { + display: block; + float: left; + padding-right: 10px; + } + + #changeset_list td.comment, #changeset_list td.area { + width: 96%; + clear: left; + } + + /* Rules for the diary entries pages */ + + #diary_entry_title, #diary_entry_body, #diary_entry_language_code, #diary_comment_body { + width: 100% !important; + } + + #usemap { + display: block; + } + + /* Rules for the messaging pages */ + + #message_title, #message_body { + width: 100% !important; + } diff --combined test/fixtures/users.yml index 9802783fd,98517fd2a..360738c22 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@@ -11,6 -11,7 +11,7 @@@ normal_user home_lat: 12.1 home_lon: 12.1 home_zoom: 3 + terms_seen: true public_user: id: 2 @@@ -24,6 -25,7 +25,7 @@@ home_lat: 12 home_lon: 12 home_zoom: 12 + terms_seen: true inactive_user: id: 3 @@@ -37,6 -39,7 +39,7 @@@ home_lat: 123.4 home_lon: 12.34 home_zoom: 15 + terms_seen: true second_public_user: id: 4 @@@ -50,6 -53,7 +53,7 @@@ home_lat: 89 home_lon: 87 home_zoom: 12 + terms_seen: true moderator_user: id: 5 @@@ -59,6 -63,7 +63,7 @@@ creation_time: "2008-05-01 01:23:45" display_name: moderator data_public: true + terms_seen: true administrator_user: id: 6 @@@ -68,13 -73,14 +73,24 @@@ creation_time: "2008-05-01 01:23:45" display_name: administrator data_public: true - terms_seen: true - openid_user: + terms_not_seen_user: id: 7 + email: not_agreed@example.com + status: active + pass_crypt: <%= Digest::MD5.hexdigest('test') %> + creation_time: "2011-03-22 00:23:45" + display_name: not_agreed + data_public: true + terms_seen: false ++ ++openid_user: ++ id: 8 + email: openid-user@example.com + status: active + pass_crypt: <%= Digest::MD5.hexdigest('test') %> + creation_time: "2008-05-01 01:23:45" + display_name: openIDuser + data_public: true + openid_url: http://localhost:1123/john.doe?openid.success=true ++ terms_seen: true diff --combined test/integration/user_blocks_test.rb index 942a94302,b4ca49022..7003d7692 --- a/test/integration/user_blocks_test.rb +++ b/test/integration/user_blocks_test.rb @@@ -38,11 -38,8 +38,8 @@@ class UserBlocksTest < ActionController # revoke the ban get '/login' - assert_response :redirect - assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true" - follow_redirect! assert_response :success - post '/login', {'user[email]' => moderator.email, 'user[password]' => "test", :referer => "/blocks/#{block.id}/revoke"} + post '/login', {'username' => moderator.email, 'password' => "test", :referer => "/blocks/#{block.id}/revoke"} assert_response :redirect follow_redirect! assert_response :success