]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Fixed some failing tests caused by the openID changes
[rails.git] / app / controllers / user_controller.rb
index fa82f62512346ac38eaa8e12bf359185b94ce795..3a4b009202b0138618a6ff879a3182078ec7c6b9 100644 (file)
@@ -46,7 +46,14 @@ class UserController < ApplicationController
                #to not get dupplicate conflicts for an empty openid 
                @user.openid_url = nil
 
-               if (params[:user][:openid_url].length > 0)
+               if (!params[:user][:openid_url].nil? and params[:user][:openid_url].length > 0)
+                 if @user.pass_crypt.length == 0 
+            #if the password is empty, but we have a openid 
+            #then generate a random passowrd to disable 
+            #loging in via password 
+            @user.pass_crypt = ActiveSupport::SecureRandom.base64(16) 
+            @user.pass_crypt_confirmation = @user.pass_crypt 
+          end
                  #Validate all of the other fields before
                  #redirecting to the openid provider
                  if !@user.valid?
@@ -275,7 +282,7 @@ class UserController < ApplicationController
     
     if params[:user] and session[:user].nil?
 
-      if !params[:user][:openid_url].empty?
+      if !params[:user][:openid_url].nil? and !params[:user][:openid_url].empty?
         open_id_authentication(params[:user][:openid_url])
       else
         email_or_display_name = params[:user][:email]