MS fixed the login bug, deploying to master
This commit is contained in:
parent
55c1530c9f
commit
8828707c45
4 changed files with 17 additions and 14 deletions
|
|
@ -30,19 +30,11 @@ class Person
|
||||||
|
|
||||||
before_destroy :remove_all_traces
|
before_destroy :remove_all_traces
|
||||||
before_validation :clean_url
|
before_validation :clean_url
|
||||||
after_create :ensure_diaspora_handle
|
|
||||||
validates_presence_of :url, :profile, :serialized_key
|
validates_presence_of :url, :profile, :serialized_key
|
||||||
validates_format_of :url, :with =>
|
validates_format_of :url, :with =>
|
||||||
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
|
||||||
|
|
||||||
|
|
||||||
def ensure_diaspora_handle
|
|
||||||
if self.owner?
|
|
||||||
self.diaspora_handle = self.owner.diaspora_handle
|
|
||||||
self.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.search(query)
|
def self.search(query)
|
||||||
Person.all('$where' => "function() { return this.diaspora_handle.match(/^#{query}/i) ||
|
Person.all('$where' => "function() { return this.diaspora_handle.match(/^#{query}/i) ||
|
||||||
this.profile.first_name.match(/^#{query}/i) ||
|
this.profile.first_name.match(/^#{query}/i) ||
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ class User
|
||||||
key :pending_request_ids, Array
|
key :pending_request_ids, Array
|
||||||
key :visible_post_ids, Array
|
key :visible_post_ids, Array
|
||||||
key :visible_person_ids, Array
|
key :visible_person_ids, Array
|
||||||
|
|
||||||
|
key :url, String
|
||||||
|
|
||||||
one :person, :class_name => 'Person', :foreign_key => :owner_id
|
one :person, :class_name => 'Person', :foreign_key => :owner_id
|
||||||
|
|
||||||
many :friends, :in => :friend_ids, :class_name => 'Person'
|
many :friends, :in => :friend_ids, :class_name => 'Person'
|
||||||
|
|
@ -32,7 +34,11 @@ class User
|
||||||
|
|
||||||
many :aspects, :class_name => 'Aspect'
|
many :aspects, :class_name => 'Aspect'
|
||||||
|
|
||||||
before_validation_on_create :setup_person
|
|
||||||
|
after_create :setup_person
|
||||||
|
after_create :seed_aspects
|
||||||
|
|
||||||
|
|
||||||
before_validation :do_bad_things
|
before_validation :do_bad_things
|
||||||
before_save :downcase_username
|
before_save :downcase_username
|
||||||
|
|
||||||
|
|
@ -286,9 +292,13 @@ class User
|
||||||
def self.instantiate!( opts = {} )
|
def self.instantiate!( opts = {} )
|
||||||
opts[:person][:diaspora_handle] = opts[:email]
|
opts[:person][:diaspora_handle] = opts[:email]
|
||||||
opts[:person][:serialized_key] = generate_key
|
opts[:person][:serialized_key] = generate_key
|
||||||
User.create!( opts)
|
User.create!(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.create(opts ={})
|
||||||
|
puts opts.inspect
|
||||||
|
end
|
||||||
|
|
||||||
def terse_url
|
def terse_url
|
||||||
terse = self.url.gsub(/(https?:|www\.)\/\//, '')
|
terse = self.url.gsub(/(https?:|www\.)\/\//, '')
|
||||||
terse = terse.chop! if terse[-1, 1] == '/'
|
terse = terse.chop! if terse[-1, 1] == '/'
|
||||||
|
|
@ -305,7 +315,7 @@ class User
|
||||||
|
|
||||||
def setup_person
|
def setup_person
|
||||||
self.person.serialized_key ||= User.generate_key.export
|
self.person.serialized_key ||= User.generate_key.export
|
||||||
#self.person.diaspora_handle ||= self.diaspora_handle
|
self.person.diaspora_handle ||= self.diaspora_handle
|
||||||
self.person.save!
|
self.person.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
|
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
|
||||||
= devise_error_messages!
|
= devise_error_messages!
|
||||||
|
= f.hidden_field :url, :value => request.host
|
||||||
%p
|
%p
|
||||||
= f.label :username
|
= f.label :username
|
||||||
= f.text_field :username
|
= f.text_field :username
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ describe Request do
|
||||||
xml = request.to_xml.to_s
|
xml = request.to_xml.to_s
|
||||||
|
|
||||||
xml.include?(@user.person.diaspora_handle).should be true
|
xml.include?(@user.person.diaspora_handle).should be true
|
||||||
xml.include?(@user.url).should be true
|
xml.include?(@user.person.url).should be true
|
||||||
xml.include?(@user.profile.first_name).should be true
|
xml.include?(@user.profile.first_name).should be true
|
||||||
xml.include?(@user.profile.last_name).should be true
|
xml.include?(@user.profile.last_name).should be true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue