Class: Users::AssociateAccountsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/users/associate_accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#connectObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/users/associate_accounts_controller.rb', line 19

def connect
  if authenticator.description_for_user(current_user).present? && authenticator.can_revoke?
    authenticator.revoke(current_user)
  end

  DiscourseEvent.trigger(:before_auth, authenticator, auth_hash, session, cookies, request)
  auth_result = authenticator.after_authenticate(auth_hash, existing_account: current_user)
  DiscourseEvent.trigger(:after_auth, authenticator, auth_result, session, cookies, request)

  secure_session[self.class.key(params[:token])] = nil

  render json: success_json
end

#connect_infoObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/users/associate_accounts_controller.rb', line 8

def connect_info
   = authenticator.description_for_auth_hash(auth_hash)
   = authenticator.description_for_user(current_user).presence
  render json: {
           token: params[:token],
           provider_name: auth_hash.provider,
           account_description: ,
           existing_account_description: ,
         }
end