]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Make sure the ID of OpenID URL fields is openid_url
[rails.git] / app / controllers / user_controller.rb
index 9e2961df2716fa95696d1efabf92cf5ec57c04ea..b337dc04c6cd8fd50014344c8ec4ae5fdb1b3a73 100644 (file)
@@ -67,7 +67,7 @@ class UserController < ApplicationController
         elsif @user.terms_agreed?
           # Already agreed to terms, so just show settings
           redirect_to :action => :account, :display_name => @user.display_name
         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]
+        elsif params[:user] and params[:user][:openid_url] and not params[:user][:openid_url].empty?
           # Verify OpenID before moving on
           session[:new_user] = @user
           openid_verify(params[:user][:openid_url], @user)
           # Verify OpenID before moving on
           session[:new_user] = @user
           openid_verify(params[:user][:openid_url], @user)
@@ -125,6 +125,7 @@ class UserController < ApplicationController
       @user.languages = request.user_preferred_languages
       @user.terms_agreed = Time.now.getutc
       @user.terms_seen = true
       @user.languages = request.user_preferred_languages
       @user.terms_agreed = Time.now.getutc
       @user.terms_seen = true
+      @user.openid_url = nil if @user.openid_url and @user.openid_url.empty?
       
       if @user.save
         flash[:notice] = t 'user.new.flash create success message', :email => @user.email
       
       if @user.save
         flash[:notice] = t 'user.new.flash create success message', :email => @user.email
@@ -538,6 +539,10 @@ private
               failed_login t('user.login.auth failure')
           end
         else
               failed_login t('user.login.auth failure')
           end
         else
+          # Guard against not getting any extension data
+          sreg = Hash.new if sreg.nil?
+          ax = Hash.new if ax.nil?
+
           # 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
           # 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