Extracted nickname registration into a private controller method

This commit is contained in:
Einar Jonsson 2013-08-23 09:38:01 +00:00
parent c409d91203
commit 84987cd835
1 changed files with 7 additions and 5 deletions

View File

@ -162,11 +162,7 @@ class UsersController < ApplicationController
user = User.new_from_params(params)
auth = authenticate_user(user, params)
if user.valid? && SiteSetting.call_discourse_hub?
DiscourseHub.register_nickname(user.username, user.email)
end
register_nickname(user)
if user.save
activator = UserActivator.new(user, session, cookies)
@ -457,4 +453,10 @@ class UsersController < ApplicationController
auth[:oauth2].is_a?(Hash) && auth[:oauth2][:provider] && auth[:oauth2][:uid] &&
Oauth2UserInfo.where(provider: auth[:oauth2][:provider], uid: auth[:oauth2][:uid]).empty?
end
def register_nickname(user)
if user.valid? && SiteSetting.call_discourse_hub?
DiscourseHub.register_nickname(user.username, user.email)
end
end
end