2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-05-13 08:27:59 +03:00
|
|
|
import Session from 'simple-auth/session';
|
|
|
|
import OAuth2 from 'simple-auth-oauth2/authenticators/oauth2';
|
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',
|
2014-07-25 17:38:13 +04:00
|
|
|
before: 'simple-auth',
|
2014-06-30 16:58:10 +04:00
|
|
|
after: 'registerTrailingLocationHistory',
|
|
|
|
|
2014-07-25 17:38:13 +04:00
|
|
|
initialize: function (container) {
|
2015-05-13 08:27:59 +03:00
|
|
|
Session.reopen({
|
2014-12-08 03:31:24 +03:00
|
|
|
user: Ember.computed(function () {
|
2014-07-01 19:58:26 +04:00
|
|
|
return container.lookup('store:main').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;
|