FEATURE: Trigger Discourse events from authenticators. (#7724)

This commit is contained in:
Dan Ungureanu 2019-06-11 04:28:42 +03:00 committed by Sam
parent d073a7d5a8
commit a046f6ced5
3 changed files with 3 additions and 1 deletions

View File

@ -43,6 +43,7 @@ class Users::OmniauthCallbacksController < ApplicationController
else
@auth_result = authenticator.after_authenticate(auth)
end
DiscourseEvent.trigger(:after_auth, authenticator, @auth_result)
preferred_origin = request.env['omniauth.origin']

View File

@ -1165,6 +1165,7 @@ class UsersController < ApplicationController
# We're likely going to contact the remote auth provider, so hijack request
hijack do
DiscourseEvent.trigger(:before_auth_revoke, authenticator, user)
result = authenticator.revoke(user, skip_remote: skip_remote)
if result
render json: success_json

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class Auth::Result
attr_accessor :user, :name, :username, :email, :user,
attr_accessor :user, :name, :username, :email,
:email_valid, :extra_data, :awaiting_activation,
:awaiting_approval, :authenticated, :authenticator_name,
:requires_invite, :not_allowed_from_ip_address,