]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Merge branch 'master' of git://git.openstreetmap.org/rails into openID
[rails.git] / app / controllers / user_controller.rb
index f9755204a27b4c0dfb6d64484d9cb41d4e2b5571..f02cd6dc1da5804a143bba654931901d22b30d8c 100644 (file)
@@ -49,7 +49,7 @@ class UserController < ApplicationController
         @user.openid_url = nil
 
         if (!params[:user][:openid_url].nil? and params[:user][:openid_url].length > 0)
-          if @user.pass_crypt.length == 0 
+          if (@user.pass_crypt.nil? or @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 
@@ -133,6 +133,8 @@ class UserController < ApplicationController
       @user.home_lat = params[:user][:home_lat]
       @user.home_lon = params[:user][:home_lon]
 
+      @user.openid_url = nil if (params[:user][:openid_url].length == 0)
+
       if @user.save
         set_locale
 
@@ -320,6 +322,10 @@ class UserController < ApplicationController
     @nickname = params['nickname']
     @email = params['email']
     @openID = params['openid']
+       
+    if !params['openid'].nil?
+         flash.now[:notice] = t 'user.new.openID association'
+       end
   end
 
   def login