From: Tom Hughes Date: Thu, 10 Feb 2011 14:10:19 +0000 (+0000) Subject: Merge branch 'master' into openid X-Git-Tag: live~6860^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/11aff90f63d79406e9efa1343c965a19dcf5dbba?ds=sidebyside;hp=--cc Merge branch 'master' into openid Conflicts: app/controllers/user_controller.rb app/views/user/login.html.erb public/stylesheets/common.css --- 11aff90f63d79406e9efa1343c965a19dcf5dbba diff --cc app/controllers/user_controller.rb index d456c1353,6935af3bc..1193ec910 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@@ -107,7 -76,8 +107,8 @@@ class UserController < ApplicationContr 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' else render :action => 'new' @@@ -139,25 -109,28 +140,31 @@@ @user.home_lat = params[:user][:home_lat] @user.home_lon = params[:user][:home_lon] + if params[:user][:preferred_editor] == "default" + @user.preferred_editor = nil + else + @user.preferred_editor = params[:user][:preferred_editor] + end + - if @user.save - set_locale + @user.openid_url = nil if params[:user][:openid_url].empty? - 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' - - 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] diff --cc app/views/user/login.html.erb index 72c768713,66a2fab99..4515f412d --- a/app/views/user/login.html.erb +++ b/app/views/user/login.html.erb @@@ -1,85 -1,25 +1,80 @@@ -

<%= t 'user.login.heading' %>

+
+ -

<%= t 'user.login.please login', :create_user_link => link_to(t('user.login.create_account'), :controller => 'user', :action => 'new', :referer => params[:referer]) %>

+
+

<%= t 'user.login.heading' %>

- <% form_tag({ :action => "login" }, { :id => "login_form" }) do %> - <%= hidden_field_tag('referer', h(params[:referer])) %> -

<%= t 'user.login.already have' %>

- - <% form_tag :action => 'login' do %> ++ <% form_tag({ :action => "login" }, { :id => "login_form" }) do %> + <%= hidden_field_tag('referer', h(params[:referer])) %> + -
-
-

<%= t 'user.login.username_heading' %>

- - - - - - - - - ++

<%= t 'user.login.with username' %>

++ +
<%= text_field_tag("username", "", { :size => 28, :maxlength => 255, :tabindex => 1 }) %>
<%= password_field_tag("password", "", { :size => 28, :maxlength => 255, :tabindex => 2 }) %>
+ + + +
<%= t 'user.login.email or username' %><%= text_field('user', 'email',{:value => "", :size => 28, :maxlength => 255, :tabindex => 1}) %>
<%= t 'user.login.password' %><%= password_field('user', 'password',{:value => "", :size => 28, :maxlength => 255, :tabindex => 2}) %> (<%= link_to t('user.login.lost password link'), :controller => 'user', :action => 'lost_password' %>)
<%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %>
+ <%= submit_tag t('user.login.login_button'), :tabindex => 3 %> ++ ++

<%= t 'user.login.with openid' %>

++ ++ + - - ++ ++ ++ + + - - ++ ++ ++ + +
(<%= link_to t('user.login.lost password link'), :controller => 'user', :action => 'lost_password' %>) ++ <%= ++ link_to_function(image_tag("openid_large.png", :alt => t("user.login.openid_providers.openid.title")), nil, :title => t("user.login.openid_providers.openid.title")) do |page| ++ page[:login_form][:openid_url].value = "http://" ++ page[:login_openid_buttons].hide ++ page[:login_openid_url].show ++ page[:login_openid_submit].show ++ end ++ %> ++ <%= openid_button "yahoo", "me.yahoo.com" %><%= openid_button "google", "gmail.com" %>
<%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %><%= openid_button "myopenid", "myopenid.com" %><%= openid_button "wordpress", "wordpress.com" %><%= openid_button "myspace", "myspace.com" %>
+ - <%= submit_tag t('user.login.login_button'), :tabindex => 4 %> -
- -
-
- -
-

<%= t 'user.login.openid_heading' %>

-
- <%= - link_to_function(image_tag("openid_large.png", :alt => t("user.login.openid_providers.openid.title")), nil, :title => t("user.login.openid_providers.openid.title")) do |page| - page[:login_form][:openid_url].value = "http://" - page[:openid_buttons].hide - page[:openid_url].show - page[:openid_url_hint].show - page[:openid_submit].show - end - %> - <%= openid_button "yahoo", "me.yahoo.com" %> - <%= openid_button "google", "gmail.com" %> - <%= openid_button "myopenid", "myopenid.com" %> - <%= openid_button "wordpress", "wordpress.com" %> - <%= openid_button "myspace", "myspace.com" %> -
- + - ++ + - - - - + + + + + + +
+ <%= t 'user.login.openid', :logo => openid_logo %> + <%= text_field_tag("openid_url", "", { :size => 28, :maxlength => 255, :tabindex => 3, :class => "openid_url" }) %>
++ <%= text_field_tag("openid_url", "", { :size => 28, :maxlength => 255, :tabindex => 3, :class => "openid_url" }) %> + (<%= t 'user.account.openid.link text' %>) +
<%= check_box_tag "remember_me", "yes", false, :tabindex => 5 %>
+ - <%= submit_tag t('user.login.login_button'), :tabindex => 6, :id => "openid_submit" %> -
++ <%= submit_tag t('user.login.login_button'), :tabindex => 6, :id => "login_openid_submit" %> + <% end %> ++ +
- <% end %> ++ +
+

<%= t 'user.login.new to osm' %>

+

<%= t 'user.login.to make changes' %>

+

<%= t 'user.login.create account minute' %>

+

<%= button_to t('user.login.register now'), :action => :new, :referer => params[:referer] %>

++ +
+
++ +
+ +<%= + update_page_tag do |page| - page[:openid_url].hide - page[:openid_url_hint].hide - page[:openid_submit].hide ++ page[:login_openid_url].hide ++ page[:login_openid_submit].hide + end +%> diff --cc config/locales/en.yml index ebd53720b,497959a14..1fa2831ea --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -1492,16 -1508,18 +1508,18 @@@ en 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:" - username_heading: "Login with username and password:" - openid_heading: "Login with 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. account not active: "Sorry, your account is not active yet.
Please use the link in the account confirmation email to activate your account, or request a new confirmation email." account suspended: Sorry, your account has been suspended due to suspicious activity.
Please contact the {{webmaster}} if you wish to discuss this. webmaster: webmaster diff --cc public/stylesheets/common.css index 36966f3ba,c830f406b..3051f52d1 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@@ -583,35 -626,34 +626,38 @@@ hr margin-top: 10px; } - /* Rules for the login form */ + /* Rules for the login page */ - .loginBox { - float: left; - border-style: solid; - border-width: 1px; - padding-left: 10px; - padding-right: 10px; - padding-bottom: 10px; + #login_wrapper { + float: left; /* ensures the child divs are the same size, and only as wide as they need to be */ } - .loginBox table { - width: 100%; + #login_wrapper div { + margin: 5px; + padding: 15px; + border-radius: 15px; + -moz-border-radius: 15px; } - .loginBox img { - border: 0; + #login_wrapper input[type=submit] { + float: right; } - .loginBox #openid_buttons img { - vertical-align: middle; + #login_login { + background-color: #f0f0f0; } - .loginBox input[type="submit"] { - float: right; + #login_login h1 { + margin-top: 5px; } - #openid_buttons { - margin-bottom: 20px; ++#login_openid_buttons img { ++ border: 0; ++} ++ + #login_signup form.button-to div { + margin: 0px; + padding: 0px; } /* Rules for the account confirmation page */ @@@ -790,11 -838,6 +842,11 @@@ input[type="submit"] border: 1px solid black; } +input.openid_url { - background: url('../images/openid_input.png') repeat-y left; ++ background: url('../images/openid_input.png') repeat-y left white; + padding-left: 16px; +} + /* Rules for user images */ img.user_image {