diff --git a/app/models/user.rb b/app/models/user.rb index 41dac47d71c..0edf48210cc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -381,7 +381,7 @@ class User < ActiveRecord::Base end def email_confirmed? - email_tokens.where(email: self.email, confirmed: true).present? + email_tokens.where(email: self.email, confirmed: true).present? or email_tokens.count == 0 end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 3e518ce38ef..8b46184b342 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -638,7 +638,7 @@ describe User do it 'should return false' do user.email_tokens.each {|t| t.destroy} user.reload - user.email_confirmed?.should be_false + user.email_confirmed?.should be_true end end end