OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Avoid updating the just created user to retain id information
Oliver Günther2e2f52013041
diff --git a/app/services/authentication/omniauth_service.rb b/app/services/authentication/omniauth_service.rbindex 2255ba6a120..6cb58e159fc 100644--- a/app/services/authentication/omniauth_service.rb+++ b/app/services/authentication/omniauth_service.rb@@ -77,7 +77,6 @@ module Authentication# After login flowdef tap_service_result(call)if call.success? && user.active?- user.log_successful_loginOpenProject::OmniAuth::Authorization.after_login! user, auth_hash, selfenddiff --git a/app/services/users/login_service.rb b/app/services/users/login_service.rbindex 6ed68f15b51..63f2a295976 100644--- a/app/services/users/login_service.rb+++ b/app/services/users/login_service.rb@@ -52,6 +52,8 @@ module Userscontroller.session.merge!(retained_values) if retained_values+ user.log_successful_login+ServiceResult.new(result: user)enddiff --git a/spec/features/auth/omniauth_spec.rb b/spec/features/auth/omniauth_spec.rbindex 0934ef3e139..68f8922a4e2 100644--- a/spec/features/auth/omniauth_spec.rb+++ b/spec/features/auth/omniauth_spec.rb@@ -184,11 +184,11 @@ describe 'Omniauth authentication', type: :feature doclick_link_or_button 'Create'end- expect(current_url).to eql home_url(first_time_user: true)+ expect(page).to have_current_path home_path(first_time_user: true)endcontext 'with password login disabled',- with_config: { disabled_password_login: 'true' } do+ with_config: { disable_password_login: 'true' } doit_behaves_like 'omniauth user registration'enddiff --git a/spec/services/authentication/omniauth_service_spec.rb b/spec/services/authentication/omniauth_service_spec.rbindex 4fe33b58951..dc6d11df073 100644--- a/spec/services/authentication/omniauth_service_spec.rb+++ b/spec/services/authentication/omniauth_service_spec.rb@@ -100,8 +100,6 @@ describe Authentication::OmniauthService do# should update the user attributesexpect(user).to receive(:update).with(user_attributes)- # Logs user login and calls callback- expect(user).to receive(:log_successful_login)expect(OpenProject::OmniAuth::Authorization).to(receive(:after_login!)).with(user, auth_hash, instance)@@ -154,8 +152,6 @@ describe Authentication::OmniauthService do# should update the user attributesexpect(user).to receive(:update).with(user_attributes)- # Logs user login and calls callback- expect(user).to receive(:log_successful_login)expect(OpenProject::OmniAuth::Authorization).to(receive(:after_login!)).with(user, auth_hash, instance)diff --git a/spec/services/users/login_service_spec.rb b/spec/services/users/login_service_spec.rbindex 74734f7de4b..0e52ae9b315 100644--- a/spec/services/users/login_service_spec.rb+++ b/spec/services/users/login_service_spec.rb@@ -65,6 +65,9 @@ describe ::Users::LoginService, type: :model dosession.clearflash.clearend++ allow(input_user)+ .to receive(:log_successful_login)endcontext 'if provider retains session values' do