mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 21:12:45 +08:00
remove duplicate code
This commit is contained in:
parent
e83cd9d111
commit
c7697bbae2
|
@ -60,22 +60,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||
auth_provider: "Twitter"
|
||||
}
|
||||
|
||||
if user_info
|
||||
if user_info.user.active?
|
||||
if Guardian.new(user_info.user).can_access_forum?
|
||||
log_on_user(user_info.user)
|
||||
@data[:authenticated] = true
|
||||
else
|
||||
@data[:awaiting_approval] = true
|
||||
end
|
||||
else
|
||||
@data[:awaiting_activation] = true
|
||||
# send another email ?
|
||||
end
|
||||
else
|
||||
@data[:name] = screen_name
|
||||
end
|
||||
|
||||
process_user_info(user_info, screen_name)
|
||||
end
|
||||
|
||||
def create_or_sign_on_user_using_facebook(auth_token)
|
||||
|
@ -265,24 +250,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||
auth_provider: "Github"
|
||||
}
|
||||
|
||||
if user_info
|
||||
if user_info.user.active?
|
||||
|
||||
if Guardian.new(user_info.user).can_access_forum?
|
||||
log_on_user(user_info.user)
|
||||
@data[:authenticated] = true
|
||||
else
|
||||
@data[:awaiting_approval] = true
|
||||
end
|
||||
|
||||
else
|
||||
@data[:awaiting_activation] = true
|
||||
# send another email ?
|
||||
end
|
||||
else
|
||||
@data[:name] = screen_name
|
||||
end
|
||||
|
||||
process_user_info(user_info, screen_name)
|
||||
end
|
||||
|
||||
def create_or_sign_on_user_using_persona(auth_token)
|
||||
|
@ -319,6 +287,26 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def process_user_info(user_info, screen_name)
|
||||
if user_info
|
||||
if user_info.user.active?
|
||||
|
||||
if Guardian.new(user_info.user).can_access_forum?
|
||||
log_on_user(user_info.user)
|
||||
@data[:authenticated] = true
|
||||
else
|
||||
@data[:awaiting_approval] = true
|
||||
end
|
||||
|
||||
else
|
||||
@data[:awaiting_activation] = true
|
||||
# send another email ?
|
||||
end
|
||||
else
|
||||
@data[:name] = screen_name
|
||||
end
|
||||
end
|
||||
|
||||
def invite_only?
|
||||
SiteSetting.invite_only? && !@data[:authenticated]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user