X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/735493837b036f5609f42a363c7f58f04525194c..9fbd888e04e545bf61789973b1ed5b457e2b1be9:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 60e35016a..f02cd6dc1 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -36,20 +36,20 @@ class UserController < ApplicationController return end else - @user = User.new(params[:user]) + @user = User.new(params[:user]) - @user.visible = true - @user.data_public = true - @user.description = "" if @user.description.nil? - @user.creation_ip = request.remote_ip - @user.languages = request.user_preferred_languages + @user.visible = true + @user.data_public = true + @user.description = "" if @user.description.nil? + @user.creation_ip = request.remote_ip + @user.languages = request.user_preferred_languages #Set the openid_url to nil as for one it is used #to check if the openid could be validated and secondly #to not get dupplicate conflicts for an empty openid @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