mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
Refactor omniauth_callbacks_controller for extensibility
This commit is contained in:
parent
2f581e6900
commit
ebf46450bc
@ -38,13 +38,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||
@data = authenticator.after_authenticate(auth)
|
||||
@data.authenticator_name = authenticator.name
|
||||
|
||||
if @data.user
|
||||
user_found(@data.user)
|
||||
elsif SiteSetting.invite_only?
|
||||
@data.requires_invite = true
|
||||
else
|
||||
session[:authentication] = @data.session_data
|
||||
end
|
||||
complete_response_data(@data)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
@ -75,6 +69,16 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||
|
||||
protected
|
||||
|
||||
def complete_response_data
|
||||
if @data.user
|
||||
user_found(@data.user)
|
||||
elsif SiteSetting.invite_only?
|
||||
@data.requires_invite = true
|
||||
else
|
||||
session[:authentication] = @data.session_data
|
||||
end
|
||||
end
|
||||
|
||||
def user_found(user)
|
||||
# automatically activate any account if a provider marked the email valid
|
||||
if !user.active && @data.email_valid
|
||||
|
Loading…
Reference in New Issue
Block a user