mirror of
https://github.com/discourse/discourse.git
synced 2025-04-26 04:14:31 +08: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.after_authenticate(auth)
|
||||||
@data.authenticator_name = authenticator.name
|
@data.authenticator_name = authenticator.name
|
||||||
|
|
||||||
if @data.user
|
complete_response_data(@data)
|
||||||
user_found(@data.user)
|
|
||||||
elsif SiteSetting.invite_only?
|
|
||||||
@data.requires_invite = true
|
|
||||||
else
|
|
||||||
session[:authentication] = @data.session_data
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
@ -75,6 +69,16 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||||||
|
|
||||||
protected
|
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)
|
def user_found(user)
|
||||||
# automatically activate any account if a provider marked the email valid
|
# automatically activate any account if a provider marked the email valid
|
||||||
if !user.active && @data.email_valid
|
if !user.active && @data.email_valid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user