mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
d6fca73f68
Fixes bug where user is unable to log into admin when subdirectory is specified
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import ghostPaths from 'ghost/utils/ghost-paths';
|
|
|
|
var Ghost = ghostPaths();
|
|
|
|
var AuthenticationInitializer = {
|
|
|
|
name: 'authentication',
|
|
before: 'simple-auth',
|
|
after: 'registerTrailingLocationHistory',
|
|
|
|
initialize: function (container) {
|
|
window.ENV = window.ENV || {};
|
|
window.ENV['simple-auth'] = {
|
|
authenticationRoute: 'signin',
|
|
routeAfterAuthentication: 'content',
|
|
authorizer: 'simple-auth-authorizer:oauth2-bearer'
|
|
};
|
|
SimpleAuth.Session.reopen({
|
|
user: function () {
|
|
return container.lookup('store:main').find('user', 'me');
|
|
}.property()
|
|
});
|
|
SimpleAuth.Authenticators.OAuth2.reopen({
|
|
serverTokenEndpoint: Ghost.apiRoot + '/authentication/token',
|
|
refreshAccessTokens: true,
|
|
makeRequest: function (url, data) {
|
|
data.client_id = 'ghost-admin';
|
|
return this._super(url, data);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
export default AuthenticationInitializer;
|