Ghost/ghost/admin/app/initializers/authentication.js

27 lines
728 B
JavaScript
Raw Normal View History

2015-02-13 07:22:32 +03:00
import Ember from 'ember';
import Session from 'simple-auth/session';
import OAuth2 from 'simple-auth-oauth2/authenticators/oauth2';
var AuthenticationInitializer = {
name: 'authentication',
before: 'simple-auth',
after: 'registerTrailingLocationHistory',
initialize: function (container) {
Session.reopen({
user: Ember.computed(function () {
return container.lookup('store:main').find('user', 'me');
})
});
OAuth2.reopen({
makeRequest: function (url, data) {
data.client_id = 'ghost-admin';
return this._super(url, data);
}
});
}
};
export default AuthenticationInitializer;