expressa 2.0.1 → 2.0.2

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.
@@ -56,13 +56,17 @@ module.exports = async function(api) {
56
56
  })
57
57
 
58
58
  api.addCollectionListener(['post', 'put'], loginCollections, async function userEmailLowerCase(req, collection, data) {
59
- data.email = data.email.toLowerCase()
59
+ if (data.email) {
60
+ data.email = data.email.toLowerCase()
61
+ }
60
62
  })
61
63
 
62
64
  api.addCollectionListener('post', loginCollections, async function userUniquenessCheck(req, collection, data) {
63
- const result = await api.db[collection].find({email: data.email})
64
- if (result.length > 0) {
65
- throw new util.ApiError(409, 'This email is already registered.')
65
+ if (data.email) {
66
+ const result = await api.db[collection].find({email: data.email})
67
+ if (result.length > 0) {
68
+ throw new util.ApiError(409, 'This email is already registered.')
69
+ }
66
70
  }
67
71
  })
68
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expressa",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "API framework using JSON schemas",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/thomas4019/expressa",