2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
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',
|
|
|
|
|
2015-06-03 00:25:56 -06:00
|
|
|
initialize: function (instance) {
|
|
|
|
var store = instance.container.lookup('store:main'),
|
|
|
|
Session = instance.container.lookup('simple-auth-session:main'),
|
|
|
|
OAuth2 = instance.container.lookup('simple-auth-authenticator:oauth2-password-grant');
|
|
|
|
|
2015-05-13 00:27:59 -05:00
|
|
|
Session.reopen({
|
2014-12-08 00:31:24 +00:00
|
|
|
user: Ember.computed(function () {
|
2015-06-03 00:25:56 -06:00
|
|
|
return store.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;
|