0
Fork 0
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:
Hannah Wolfe 2015-08-27 22:28:29 +01:00
parent 95e6b0a59d
commit 6926e20478
2 changed files with 7 additions and 7 deletions

View file

@ -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);
});
});
};

View file

@ -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) {