mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
Merge pull request #1371 from einarj/cleanup_user_registration
Extracted nickname registration into a private controller method
This commit is contained in:
commit
b74754e673
@ -162,11 +162,7 @@ class UsersController < ApplicationController
|
|||||||
|
|
||||||
user = User.new_from_params(params)
|
user = User.new_from_params(params)
|
||||||
auth = authenticate_user(user, params)
|
auth = authenticate_user(user, params)
|
||||||
|
register_nickname(user)
|
||||||
if user.valid? && SiteSetting.call_discourse_hub?
|
|
||||||
DiscourseHub.register_nickname(user.username, user.email)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if user.save
|
if user.save
|
||||||
activator = UserActivator.new(user, session, cookies)
|
activator = UserActivator.new(user, session, cookies)
|
||||||
@ -457,4 +453,10 @@ class UsersController < ApplicationController
|
|||||||
auth[:oauth2].is_a?(Hash) && auth[:oauth2][:provider] && auth[:oauth2][:uid] &&
|
auth[:oauth2].is_a?(Hash) && auth[:oauth2][:provider] && auth[:oauth2][:uid] &&
|
||||||
Oauth2UserInfo.where(provider: auth[:oauth2][:provider], uid: auth[:oauth2][:uid]).empty?
|
Oauth2UserInfo.where(provider: auth[:oauth2][:provider], uid: auth[:oauth2][:uid]).empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def register_nickname(user)
|
||||||
|
if user.valid? && SiteSetting.call_discourse_hub?
|
||||||
|
DiscourseHub.register_nickname(user.username, user.email)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user