From 61e40debb56b94f4c469ef1e1bfda860b146add6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 4 Dec 2010 22:25:28 -0800 Subject: [PATCH 1/2] Fix in find_for_authentication --- app/models/user.rb | 1 + spec/models/user_spec.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 7979cbed2..32b2ee34f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -76,6 +76,7 @@ class User end def self.find_for_authentication(conditions={}) + conditions[:username] = conditions[:username].downcase if conditions[:username] =~ /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i # email regex conditions[:email] = conditions.delete(:username) end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 464787133..6caf31645 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -242,9 +242,15 @@ describe User do end describe ".find_for_authentication" do - it "preserves case" do + before do + user + user2 + end + it 'finds a user' do User.find_for_authentication(:username => user.username).should == user - User.find_for_authentication(:username => user.username.upcase).should be_nil + end + it "does not preserve case" do + User.find_for_authentication(:username => user.username.upcase).should == user end end From 4bbbbf6bb1e33310d2627ad96c4fd4475f6cc71f Mon Sep 17 00:00:00 2001 From: OhaiBBQ Date: Sun, 5 Dec 2010 09:44:10 +0300 Subject: [PATCH 2/2] tipsy on sidebar avatars --- public/javascripts/view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/view.js b/public/javascripts/view.js index e166fc30e..870d1f07a 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -147,7 +147,7 @@ var View = { avatars: { bind: function() { - $(".left_pane img.avatar, #manage_aspect_zones img.avatar").tipsy({ + $("#left_pane img.avatar, #manage_aspect_zones img.avatar").tipsy({ live: true }); }