remove duplicate code
This commit is contained in:
parent
e83cd9d111
commit
c7697bbae2
|
@ -60,22 +60,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
auth_provider: "Twitter"
|
auth_provider: "Twitter"
|
||||||
}
|
}
|
||||||
|
|
||||||
if user_info
|
process_user_info(user_info, screen_name)
|
||||||
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
|
end
|
||||||
|
|
||||||
def create_or_sign_on_user_using_facebook(auth_token)
|
def create_or_sign_on_user_using_facebook(auth_token)
|
||||||
|
@ -265,24 +250,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
auth_provider: "Github"
|
auth_provider: "Github"
|
||||||
}
|
}
|
||||||
|
|
||||||
if user_info
|
process_user_info(user_info, screen_name)
|
||||||
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
|
end
|
||||||
|
|
||||||
def create_or_sign_on_user_using_persona(auth_token)
|
def create_or_sign_on_user_using_persona(auth_token)
|
||||||
|
@ -319,6 +287,26 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
|
|
||||||
private
|
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?
|
def invite_only?
|
||||||
SiteSetting.invite_only? && !@data[:authenticated]
|
SiteSetting.invite_only? && !@data[:authenticated]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue