mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
moved config into init function
This commit is contained in:
parent
e7c0d13f7c
commit
ce5e757672
@ -116,6 +116,8 @@
|
||||
if (req.params.id !== undefined) {
|
||||
api.posts.read({id: parseInt(req.params.id, 10)})
|
||||
.then(function (post) {
|
||||
// res.flash('success', 'test');
|
||||
console.log('this thing runs');
|
||||
res.render('editor', {
|
||||
bodyClass: 'editor',
|
||||
adminNav: setSelected(adminNavbar, 'content'),
|
||||
@ -186,7 +188,6 @@
|
||||
} else {
|
||||
req.flash('success', 'User Added');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -44,25 +44,15 @@
|
||||
*/
|
||||
Ghost = function () {
|
||||
var app,
|
||||
globals,
|
||||
plugin,
|
||||
polyglot;
|
||||
|
||||
|
||||
if (!instance) {
|
||||
// this.init();
|
||||
instance = this;
|
||||
plugin = new ExampleFilter(instance).init();
|
||||
|
||||
/**
|
||||
* Save the global bits here so that it can
|
||||
* be reused in app.js
|
||||
* @author javorszky (blame me)
|
||||
*/
|
||||
jsonDataProvider.save(config.blogData);
|
||||
jsonDataProvider.findAll(function (error, data) {
|
||||
globals = data;
|
||||
});
|
||||
|
||||
app = express();
|
||||
|
||||
polyglot = new Polyglot();
|
||||
@ -74,7 +64,7 @@
|
||||
_.extend(instance, {
|
||||
app: function () { return app; },
|
||||
config: function () { return config; },
|
||||
globals: function () { return globals; }, // there's no management here to be sure this has loaded
|
||||
globals: function () { return instance.init(); }, // there's no management here to be sure this has loaded
|
||||
dataProvider: function () { return bookshelfDataProvider; },
|
||||
statuses: function () { return statuses; },
|
||||
polyglot: function () { return polyglot; },
|
||||
@ -87,11 +77,22 @@
|
||||
'lang': __dirname + '/lang/'
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
|
||||
Ghost.prototype.init = function() {
|
||||
var globals;
|
||||
jsonDataProvider.save(config.blogData);
|
||||
jsonDataProvider.findAll(function (error, data) {
|
||||
globals = data;
|
||||
});
|
||||
return globals;
|
||||
};
|
||||
|
||||
/**
|
||||
* Holds the filters
|
||||
* @type {Array}
|
||||
|
@ -30,9 +30,10 @@
|
||||
// Clone the _user so we don't expose the hashed password unnecessarily
|
||||
userData = _.extend({}, _user);
|
||||
|
||||
|
||||
return self.model.forge({email_address: userData.email_address}).fetch().then(function (user) {
|
||||
if (!!user.attributes.email_address) {
|
||||
return when.reject(new Error('A user with that email address already exists.'));
|
||||
when.reject(new Error('A user with that email address already exists.'));
|
||||
}
|
||||
|
||||
return nodefn.call(bcrypt.hash, _user.password, null, null).then(function (hash) {
|
||||
|
Loading…
Reference in New Issue
Block a user