mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Fix upgrade path from really old versions
closes #5692, refs felixrieseberg/Ghost-Azure#1 - fix broken promise code - fix incorrect handling of hash in user.add which causes 'Error: Invalid salt version 2' if owner user fixture is not present
This commit is contained in:
parent
95e6b0a59d
commit
6926e20478
2 changed files with 7 additions and 7 deletions
|
@ -89,18 +89,18 @@ to003 = function (options) {
|
|||
|
||||
// To safely upgrade, we need to clear up the existing permissions and permissions_roles before recreating the new
|
||||
// full set of permissions defined as of version 003
|
||||
models.Permissions.forge().fetch().then(function (permissions) {
|
||||
return models.Permissions.forge().fetch().then(function (permissions) {
|
||||
logInfo('Removing old permissions');
|
||||
permissions.each(function (permission) {
|
||||
ops.push(permission.related('roles').detach().then(function () {
|
||||
return permission.destroy();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
// Now we can perform the normal populate
|
||||
return Promise.all(ops).then(function () {
|
||||
return populate(options);
|
||||
// Now we can perform the normal populate
|
||||
return Promise.all(ops).then(function () {
|
||||
return populate(options);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -388,9 +388,9 @@ User = ghostBookshelf.Model.extend({
|
|||
roles = data.roles || getAuthorRole();
|
||||
delete data.roles;
|
||||
|
||||
return generatePasswordHash(userData.password).then(function then(results) {
|
||||
return generatePasswordHash(userData.password).then(function then(hash) {
|
||||
// Assign the hashed password
|
||||
userData.password = results[1];
|
||||
userData.password = hash;
|
||||
// LookupGravatar
|
||||
return self.gravatarLookup(userData);
|
||||
}).then(function then(userData) {
|
||||
|
|
Loading…
Add table
Reference in a new issue