Skip to content
Extraits de code Groupes Projets
Valider 32fc6212 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

Put only the hostname in diaspora_handle

parent d1246867
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -89,7 +89,7 @@ class Person ...@@ -89,7 +89,7 @@ class Person
rescue SocketError => e rescue SocketError => e
raise "Diaspora server for #{identifier} not found" if e.message =~ /Name or service not known/ raise "Diaspora server for #{identifier} not found" if e.message =~ /Name or service not known/
end 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 ) Person.from_webfinger_profile(identifier, f )
end end
end end
...@@ -97,7 +97,11 @@ class Person ...@@ -97,7 +97,11 @@ class Person
def self.from_webfinger_profile( identifier, profile) def self.from_webfinger_profile( identifier, profile)
new_person = Person.new 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 new_person.exported_key = Base64.decode64 public_key
guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href
......
...@@ -286,7 +286,7 @@ class User ...@@ -286,7 +286,7 @@ class User
###Helpers############ ###Helpers############
def self.instantiate!( opts = {} ) 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 opts[:person][:serialized_key] = generate_key
User.create!(opts) User.create!(opts)
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter