FIX: Ensure :after_auth event is triggered. (#7791)

This commit is contained in:
Dan Ungureanu 2019-06-21 21:57:49 +03:00 committed by GitHub
parent 02f6db4e59
commit ee8669d778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -32,9 +32,11 @@ class Users::OmniauthCallbacksController < ApplicationController
@auth_result = authenticator.after_authenticate(auth, existing_account: current_user)
if provider&.full_screen_login || cookies['fsl']
cookies.delete('fsl')
DiscourseEvent.trigger(:after_auth, authenticator, @auth_result)
return redirect_to Discourse.base_uri("/my/preferences/account")
else
@auth_result.authenticated = true
DiscourseEvent.trigger(:after_auth, authenticator, @auth_result)
return respond_to do |format|
format.html
format.json { render json: @auth_result.to_client_hash }
@ -42,8 +44,8 @@ class Users::OmniauthCallbacksController < ApplicationController
end
else
@auth_result = authenticator.after_authenticate(auth)
end
DiscourseEvent.trigger(:after_auth, authenticator, @auth_result)
end
preferred_origin = request.env['omniauth.origin']