]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Test openid based user creation right through to the final save
[rails.git] / app / controllers / user_controller.rb
index cc4ae4cd82e455479c5697bffa30862e39bbddbe..2e80682a38a42a9294f8b3b3525db992a8337e54 100644 (file)
@@ -46,7 +46,7 @@ class UserController < ApplicationController
       @title = t 'user.terms.title'
       @user = User.new(params[:user]) if params[:user]
 
-      if params[:user][:openid_url] and @user.pass_crypt.empty?
+      if params[:user] and params[:user][:openid_url] and @user.pass_crypt.empty?
         # We are creating an account with OpenID and no password
         # was specified so create a random one
         @user.pass_crypt = ActiveSupport::SecureRandom.base64(16) 
@@ -60,7 +60,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 params[:user][:openid_url]
+        elsif params[:user] and params[:user][:openid_url]
           # Verify OpenID before moving on
           session[:new_user] = @user
           openid_verify(params[:user][:openid_url], @user)
@@ -231,7 +231,7 @@ class UserController < ApplicationController
       else
         password_authentication(params[:username], params[:password])
       end
-    else
+    elsif flash[:notice].nil?
       flash.now[:notice] =  t 'user.login.notice'
     end
   end