DEV: Pass the cookie jar to the :after_auth event (#13591)

Plugins can add custom cookies by hooking to this event. The auth result is also included in this event so they can know if auth was successful.
This commit is contained in:
Roman Rizzi
2021-07-01 09:44:58 -03:00
committed by GitHub
parent e4aa02365c
commit 0da2197219
2 changed files with 4 additions and 4 deletions

View File

@@ -27,9 +27,9 @@ class Users::AssociateAccountsController < ApplicationController
authenticator = Discourse.enabled_authenticators.find { |a| a.name == provider_name }
raise Discourse::InvalidAccess.new(I18n.t('authenticator_not_found')) if authenticator.nil?
DiscourseEvent.trigger(:before_auth, authenticator, auth)
DiscourseEvent.trigger(:before_auth, authenticator, auth, session, cookies)
auth_result = authenticator.after_authenticate(auth, existing_account: current_user)
DiscourseEvent.trigger(:after_auth, authenticator, auth_result)
DiscourseEvent.trigger(:after_auth, authenticator, auth_result, session, cookies)
render json: success_json
end