Ghost/core/client/routes/posts/index.js
Sebastian Gierlinger c8e8da4780 oAuth
closes #2759
closes #3027

- added oauth2orize library for server side oAuth handling
- added ember-simple-auth library for admin oAuth handling
- added tables for client, accesstoken and refreshtoken
- implemented RFC6749 4.3 Ressouce Owner Password Credentials Grant
- updated api tests with oAuth
- removed session, authentication is now token based

Known issues:
- Restore spam prevention #3128
- Signin after Signup #3125
- Signin validation #3125

**Attention**
- oldClient doesn't work with this PR anymore, session authentication
was
removed
2014-06-30 14:58:10 +02:00

23 lines
657 B
JavaScript

import loadingIndicator from 'ghost/mixins/loading-indicator';
var PostsIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, loadingIndicator, {
// redirect to first post subroute unless no posts exist
beforeModel: function () {
var self = this;
return this.store.find('post', {
status: 'all',
staticPages: 'all',
include: 'tags'
}).then(function (records) {
var post = records.get('firstObject');
if (post) {
return self.transitionTo('posts.post', post);
}
});
}
});
export default PostsIndexRoute;