From: Tom Hughes Date: Sun, 5 Dec 2010 15:15:55 +0000 (+0000) Subject: Merge branch 'master' into openid X-Git-Tag: live~6863 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/0ea9f92be50a8763331a81d3c32a5f5a157265c6?ds=sidebyside Merge branch 'master' into openid Conflicts: app/controllers/user_controller.rb --- 0ea9f92be50a8763331a81d3c32a5f5a157265c6 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]