@modular-rest/server 1.18.0 → 1.18.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.
@@ -18,7 +18,7 @@ const authSchema = new mongoose_1.Schema({
18
18
  authSchema.index({ email: 1 }, { unique: true });
19
19
  authSchema.pre(['save', 'updateOne'], function (next) {
20
20
  // Encode the password before saving
21
- if (this.isModified && this.isModified('password')) {
21
+ if (this.isModified && this.isModified('password') && this.password) {
22
22
  this.password = Buffer.from(this.password).toString('base64');
23
23
  }
24
24
  next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-rest/server",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "TypeScript version of a nodejs module based on KOAJS for developing Rest-APIs in a modular solution.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@ const authSchema = new Schema(
24
24
  authSchema.index({ email: 1 }, { unique: true });
25
25
  authSchema.pre(['save', 'updateOne'], function (this: AuthDocument, next) {
26
26
  // Encode the password before saving
27
- if (this.isModified && this.isModified('password')) {
27
+ if (this.isModified && this.isModified('password') && this.password) {
28
28
  this.password = Buffer.from(this.password).toString('base64');
29
29
  }
30
30
  next();