@dhyasama/totem-models 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Account.js CHANGED
@@ -70,12 +70,13 @@ module.exports = function(mongoose, config) {
70
70
  });
71
71
 
72
72
  Account.statics.findByEmail = function(email, cb) {
73
- this
74
- .findOne({ 'email': email})
73
+
74
+ var self = this;
75
+
76
+ self
77
+ .findOne({ 'email': (email || '').toLowerCase()})
75
78
  .populate('person')
76
- .exec(function (err, account) {
77
- cb(err, account);
78
- });
79
+ .exec(cb);
79
80
  };
80
81
 
81
82
  Account.statics.findByUsername = function(username, cb) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
package/test/Account.js CHANGED
@@ -93,6 +93,16 @@ describe('Account', function() {
93
93
 
94
94
  });
95
95
 
96
+ it('finds by uppercase email', function(done) {
97
+
98
+ Account.findByEmail('TEST@TOTEMVC.COM', function(err, account) {
99
+ should.not.exist(err);
100
+ should.exist(account);
101
+ done();
102
+ });
103
+
104
+ });
105
+
96
106
  it('lists all active accounts', function(done) {
97
107
 
98
108
  Account.listAllAccounts(function(err, result) {