mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 10:53:58 +08:00
DEV: Add session
to before_auth
and after_auth
hooks (#13123)
This allows plugins to store/modify things in the session (e.g. the destination_url). This change is backwards compatible with existing plugins. If they do not specify a third argument, they will just be passed the first two.
This commit is contained in:
parent
93ae1b2b1c
commit
fc6e7dd3f1
|
@ -33,10 +33,10 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||
Discourse.redis.setex "#{Users::AssociateAccountsController::REDIS_PREFIX}_#{current_user.id}_#{token}", 10.minutes, auth.to_json
|
||||
return redirect_to "#{Discourse.base_path}/associate/#{token}"
|
||||
else
|
||||
DiscourseEvent.trigger(:before_auth, authenticator, auth)
|
||||
DiscourseEvent.trigger(:before_auth, authenticator, auth, session)
|
||||
@auth_result = authenticator.after_authenticate(auth)
|
||||
@auth_result.user = nil if @auth_result&.user&.staged # Treat staged users the same as unregistered users
|
||||
DiscourseEvent.trigger(:after_auth, authenticator, @auth_result)
|
||||
DiscourseEvent.trigger(:after_auth, authenticator, @auth_result, session)
|
||||
end
|
||||
|
||||
preferred_origin = request.env['omniauth.origin']
|
||||
|
|
Loading…
Reference in New Issue
Block a user