2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2015-05-13 00:27:59 -05:00
|
|
|
import Session from 'simple-auth/session';
|
|
|
|
import OAuth2 from 'simple-auth-oauth2/authenticators/oauth2';
|
2014-08-10 22:48:11 +08:00
|
|
|
|
2015-05-13 00:27:59 -05:00
|
|
|
var AuthenticationInitializer = {
|
2014-06-30 14:58:10 +02:00
|
|
|
name: 'authentication',
|
2014-07-25 15:38:13 +02:00
|
|
|
before: 'simple-auth',
|
2014-06-30 14:58:10 +02:00
|
|
|
after: 'registerTrailingLocationHistory',
|
|
|
|
|
2014-07-25 15:38:13 +02:00
|
|
|
initialize: function (container) {
|
2015-05-13 00:27:59 -05:00
|
|
|
Session.reopen({
|
2014-12-08 00:31:24 +00:00
|
|
|
user: Ember.computed(function () {
|
2014-07-01 17:58:26 +02:00
|
|
|
return container.lookup('store:main').find('user', 'me');
|
2014-12-08 00:31:24 +00:00
|
|
|
})
|
2014-07-01 17:58:26 +02:00
|
|
|
});
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2015-05-13 00:27:59 -05:00
|
|
|
OAuth2.reopen({
|
2014-07-25 15:38:13 +02:00
|
|
|
makeRequest: function (url, data) {
|
2014-06-30 14:58:10 +02:00
|
|
|
data.client_id = 'ghost-admin';
|
2014-07-25 15:38:13 +02:00
|
|
|
return this._super(url, data);
|
2014-06-30 14:58:10 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-07-01 17:58:26 +02:00
|
|
|
export default AuthenticationInitializer;
|