Ghost/core/client/app/routes/settings/labs.js
Kevin Ansfield 42b25a00e3 Ensure settings routes redirect to /signin when not authenticated
closes #5412
- call this._super() in beforeModel hooks so that simple-auth can handle the transition before we hit any protected API endpoints
2015-06-17 00:24:01 +01:00

23 lines
716 B
JavaScript

import AuthenticatedRoute from 'ghost/routes/authenticated';
import styleBody from 'ghost/mixins/style-body';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
titleToken: 'Settings - Labs',
classNames: ['settings'],
beforeModel: function (transition) {
this._super(transition);
return this.get('session.user')
.then(this.transitionAuthor())
.then(this.transitionEditor());
},
model: function () {
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) {
return records.get('firstObject');
});
}
});