update account registration check for new redmine version (#49571)

This commit is contained in:
Frédéric Péters 2020-12-17 15:32:05 +01:00
parent fde4238d4e
commit 4fa61896fe
1 changed files with 3 additions and 3 deletions

View File

@ -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