Merge branch 'master' of github.com:discourse/discourse

This commit is contained in:
Sam Saffron 2013-02-06 16:28:38 +11:00
commit 31c5859bbe
3 changed files with 2138 additions and 84 deletions

View file

@ -176,7 +176,7 @@ class User < ActiveRecord::Base
end
def self.email_hash(email)
Digest::MD5.hexdigest(email)
Digest::MD5.hexdigest(email.strip.downcase)
end
def email_hash

File diff suppressed because it is too large Load diff

View file

@ -291,6 +291,22 @@ describe User do
it 'should have a sane email hash' do
@user.email_hash.should =~ /^[0-9a-f]{32}$/
end
it 'should use downcase email' do
@user.email = "example@example.com"
@user2 = Fabricate(:user)
@user2.email = "ExAmPlE@eXaMpLe.com"
@user.email_hash.should == @user2.email_hash
end
it 'should trim whitespace before hashing' do
@user.email = "example@example.com"
@user2 = Fabricate(:user)
@user2.email = " example@example.com "
@user.email_hash.should == @user2.email_hash
end
end
describe 'name heuristics' do