mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
7bfe6e9db7
closes #3162 - removes injection of user object in application route's beforeModel - removes injection/cleanup of user object in signedIn/signedOut actions - removes loading of user and passing to signedIn action in signup/setup controllers - adds 'user' property to session object - updates header nav to reference session.user - sets model of settings/user route to session.user and forces reload - on leaving settings/user, rollback any unsaved changes
29 lines
963 B
JavaScript
29 lines
963 B
JavaScript
var AuthenticationInitializer = {
|
|
|
|
name: 'authentication',
|
|
after: 'registerTrailingLocationHistory',
|
|
|
|
initialize: function (container, application) {
|
|
Ember.SimpleAuth.Session.reopen({
|
|
user: function () {
|
|
return container.lookup('store:main').find('user', 'me');
|
|
}.property()
|
|
});
|
|
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
|
|
serverTokenEndpoint: '/ghost/api/v0.1/authentication/token',
|
|
refreshAccessTokens: true,
|
|
makeRequest: function (data) {
|
|
data.client_id = 'ghost-admin';
|
|
return this._super(data);
|
|
}
|
|
});
|
|
Ember.SimpleAuth.setup(container, application, {
|
|
authenticationRoute: 'signin',
|
|
routeAfterAuthentication: 'content',
|
|
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer'
|
|
});
|
|
}
|
|
};
|
|
|
|
export default AuthenticationInitializer;
|