Put only the hostname in diaspora_handle
This commit is contained in:
parent
d124686723
commit
32fc6212ab
2 changed files with 7 additions and 3 deletions
|
|
@ -89,7 +89,7 @@ class Person
|
|||
rescue SocketError => e
|
||||
raise "Diaspora server for #{identifier} not found" if e.message =~ /Name or service not known/
|
||||
end
|
||||
raise "No webfinger profile found at #{identifier}" unless f
|
||||
raise "No webfinger profile found at #{identifier}" if f.nil? || f.links.empty?
|
||||
Person.from_webfinger_profile(identifier, f )
|
||||
end
|
||||
end
|
||||
|
|
@ -97,7 +97,11 @@ class Person
|
|||
def self.from_webfinger_profile( identifier, profile)
|
||||
new_person = Person.new
|
||||
|
||||
public_key = profile.links.select{|x| x.rel == 'diaspora-public-key'}.first.href
|
||||
public_key_entry = profile.links.select{|x| x.rel == 'diaspora-public-key'}
|
||||
|
||||
return nil unless public_key_entry
|
||||
|
||||
public_key = public_key_entry.first.href
|
||||
new_person.exported_key = Base64.decode64 public_key
|
||||
|
||||
guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ class User
|
|||
|
||||
###Helpers############
|
||||
def self.instantiate!( opts = {} )
|
||||
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{opts[:url]}"
|
||||
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{URI::parse(opts[:url]).host}"
|
||||
opts[:person][:serialized_key] = generate_key
|
||||
User.create!(opts)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue