X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d9ed74265ff1cd290beb85612e409e6748a92f60..45f12aa99e9f9634b5494c9f56a5a92168c62305:/app/controllers/user_controller.rb?ds=sidebyside diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index fa82f6251..3a4b00920 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -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]