diff options
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0010-users-password.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/server/initializers/migrations/0010-users-password.js b/server/initializers/migrations/0010-users-password.js index e031fa142..a0616a269 100644 --- a/server/initializers/migrations/0010-users-password.js +++ b/server/initializers/migrations/0010-users-password.js | |||
@@ -2,6 +2,7 @@ | |||
2 | Convert plain user password to encrypted user password. | 2 | Convert plain user password to encrypted user password. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | const eachSeries = require('async/eachSeries') | ||
5 | const mongoose = require('mongoose') | 6 | const mongoose = require('mongoose') |
6 | 7 | ||
7 | const User = mongoose.model('User') | 8 | const User = mongoose.model('User') |
@@ -10,11 +11,9 @@ exports.up = function (callback) { | |||
10 | User.list(function (err, users) { | 11 | User.list(function (err, users) { |
11 | if (err) return callback(err) | 12 | if (err) return callback(err) |
12 | 13 | ||
13 | users.forEach(function (user) { | 14 | eachSeries(users, function (user, callbackEach) { |
14 | user.save() | 15 | user.save(callbackEach) |
15 | }) | 16 | }, callback) |
16 | |||
17 | return callback(null) | ||
18 | }) | 17 | }) |
19 | } | 18 | } |
20 | 19 | ||