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
Allow registered users to become activated
Oliver Günther62d995925102
diff --git a/app/services/authentication/omniauth_service.rb b/app/services/authentication/omniauth_service.rbindex 1c599c99744..050ad018eac 100644--- a/app/services/authentication/omniauth_service.rb+++ b/app/services/authentication/omniauth_service.rb@@ -191,7 +191,7 @@ module Authenticationenddef activate_user!- if user.new_record? || user.invited?+ if activatable?::Users::RegisterUserService.new(user).call@@ -200,6 +200,16 @@ module Authenticationendend+ ##+ # Determines if the given user is activatable on the fly, that is:+ #+ # 1. The user has just been initialized by us+ # 2. The user has been invited+ # 3. The user had been registered manually (e.g., through a previous self-registration setting)+ def activatable?+ user.new_record? || user.invited? || user.registered?+ end+### Maps the omniauth attribute hash# to our internal user attributesdiff --git a/spec/controllers/concerns/omniauth_login_spec.rb b/spec/controllers/concerns/omniauth_login_spec.rbindex b3fd79a47fe..fae5fc1d5a3 100644--- a/spec/controllers/concerns/omniauth_login_spec.rb+++ b/spec/controllers/concerns/omniauth_login_spec.rb@@ -442,12 +442,9 @@ describe AccountController,post :omniauth_login, params: { provider: :google }end- it 'shows an error about a not activated account' do- expect(flash[:error]).to eql(I18n.t('account.error_inactive_activation_by_mail'))- end-- it 'redirects to signin_path' do- expect(response).to redirect_to signin_path+ it 'shows a notice about the activated account', :aggregate_failures do+ expect(flash[:notice]).to eq(I18n.t('notice_account_registered_and_logged_in'))+ expect(user.reload).to be_activeendend