mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Merge branch 'master' of github.com:discourse/discourse
This commit is contained in:
commit
31c5859bbe
3 changed files with 2138 additions and 84 deletions
|
@ -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
|
||||
|
|
2068
db/structure.sql
2068
db/structure.sql
File diff suppressed because it is too large
Load diff
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue