mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Signup form: prefill username if Discourse Hub has a match for the email address. Also, fix some bad specs in username_checker_service_spec that were passing...
This commit is contained in:
@@ -32,6 +32,11 @@ module DiscourseHub
|
||||
[json['match'], json['available'] || false, json['suggestion']]
|
||||
end
|
||||
|
||||
def self.nickname_for_email(email)
|
||||
json = get('/users/nickname_match', {email: email})
|
||||
json['suggestion']
|
||||
end
|
||||
|
||||
def self.register_nickname(nickname, email)
|
||||
json = post('/users', {nickname: nickname, email: email})
|
||||
if json.has_key?('success')
|
||||
@@ -100,7 +105,7 @@ module DiscourseHub
|
||||
if Rails.env == 'production'
|
||||
'http://api.discourse.org/api'
|
||||
else
|
||||
'http://local.hub:3000/api'
|
||||
ENV['HUB_BASE_URL'] || 'http://local.hub:3000/api'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user