Ghost/ghost/admin/app/initializers/authentication.js
Jason Williams 4ad1c59a74 Update to simple-auth 0.8
No issue
- ember-simple-auth@0.8.0-beta.2.
- Switch from SimpleAuth global to ember-cli-simple-auth and
  ES6 imports.
- Refactor controllers to handle changes in 0.8.
- Introduces a new initializer to override some configuration
  items that are set in environment.js but need to be set with
  information that's only (easily) available at runtime.
2015-05-22 15:21:46 -05:00

27 lines
728 B
JavaScript

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;