Skip to content

Commit 8973482

Browse files
committed
Refactor GitHub authentication flow and update PersonPlatformIntegration lookup
1 parent 6c800ce commit 8973482

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/controllers/better_together/omniauth_callbacks_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ def github
2020
def handle_auth(kind)
2121
if user.present?
2222
flash[:success] = t 'devise_omniauth_callbacks.success', kind: kind if is_navigational_format?
23-
sign_in_and_redirect user, event: :authentication
24-
redirect_to edit_user_registration_path
23+
sign_in_and_redirect user, event: :authentication # This handles the redirect
2524
else
2625
flash[:alert] =
2726
t 'devise_omniauth_callbacks.failure', kind:, reason: "#{auth.info.email} is not authorized"
@@ -34,7 +33,8 @@ def auth
3433
end
3534

3635
def set_person_platform_integration
37-
@person_platform_integration = PersonPlatformIntegration.find_by(provider: auth.provider, uid: auth.uid)
36+
@person_platform_integration = BetterTogether::PersonPlatformIntegration.find_by(provider: auth.provider,
37+
uid: auth.uid)
3838
end
3939

4040
def set_user

spec/controllers/better_together/omniauth_callbacks_controller_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
let(:platform) { configure_host_platform }
1212
let(:community) { platform.community }
13+
let!(:github_platform) { create(:better_together_platform, :oauth_provider, identifier: 'github', name: 'GitHub') }
1314

1415
before do
1516
# Set up test platform for host application

0 commit comments

Comments
 (0)