2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-08-10 18:48:11 +04:00
|
|
|
|
2015-05-13 08:27:59 +03:00
|
|
|
var AuthenticationInitializer = {
|
2014-06-30 16:58:10 +04:00
|
|
|
name: 'authentication',
|
|
|
|
|
2015-06-03 09:25:56 +03: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 08:27:59 +03:00
|
|
|
Session.reopen({
|
2014-12-08 03:31:24 +03:00
|
|
|
user: Ember.computed(function () {
|
2015-06-03 09:25:56 +03:00
|
|
|
return store.find('user', 'me');
|
2014-12-08 03:31:24 +03:00
|
|
|
})
|
2014-07-01 19:58:26 +04:00
|
|
|
});
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2015-05-13 08:27:59 +03:00
|
|
|
OAuth2.reopen({
|
2014-07-25 17:38:13 +04:00
|
|
|
makeRequest: function (url, data) {
|
2014-06-30 16:58:10 +04:00
|
|
|
data.client_id = 'ghost-admin';
|
2014-07-25 17:38:13 +04:00
|
|
|
return this._super(url, data);
|
2014-06-30 16:58:10 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-07-01 19:58:26 +04:00
|
|
|
export default AuthenticationInitializer;
|