From 4fa61896fe8fb8043659e6ef540be961f0a6758c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 17 Dec 2020 15:32:05 +0100 Subject: [PATCH] update account registration check for new redmine version (#49571) --- lib/account_controller_patch.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/account_controller_patch.rb b/lib/account_controller_patch.rb index 78c8855..01ea66e 100644 --- a/lib/account_controller_patch.rb +++ b/lib/account_controller_patch.rb @@ -3,10 +3,11 @@ module AccountControllerNameCheckPatch base.class_eval do def register (redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration] - if request.get? + if !request.post? session[:auth_source_registration] = nil @user = User.new(:language => current_language.to_s) else + user_params = params[:user] || {} user_params = params[:user] || {} if user_params[:firstname] == user_params[:lastname] # common spam pattern @@ -16,7 +17,7 @@ module AccountControllerNameCheckPatch end @user = User.new @user.safe_attributes = user_params - @user.pref.attributes = params[:pref] if params[:pref] + @user.pref.safe_attributes = params[:pref] @user.admin = false @user.register if session[:auth_source_registration] @@ -30,7 +31,6 @@ module AccountControllerNameCheckPatch redirect_to my_account_path end else - @user.login = params[:user][:login] unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank? @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] end