mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed "Authorization failed" errors during setup and signin
no issue - the `custom-views` and `navigation` services would trigger their observers immediately when `this.session.user` changed but that would occur before authentication had fully finished which was resulting in the `this.session.user` access triggering a request with no cookie/an old cookie set and causing a 403 error that interrupted the setup and authentication flows
This commit is contained in:
parent
2226861e17
commit
7c205c1a55
2 changed files with 14 additions and 2 deletions
|
@ -115,8 +115,14 @@ export default class CustomViewsService extends Service {
|
|||
}
|
||||
|
||||
// eslint-disable-next-line ghost/ember/no-observers
|
||||
@observes('session.user.accessibility')
|
||||
@observes('session.isAuthenticated', 'session.user.accessibility')
|
||||
async updateViewList() {
|
||||
// avoid fetching user before authenticated otherwise the 403 can fire
|
||||
// during authentication and cause errors during setup/signin
|
||||
if (!this.session.isAuthenticated) {
|
||||
return;
|
||||
}
|
||||
|
||||
let user = await this.session.user;
|
||||
let userSettings = user.get('accessibility');
|
||||
|
||||
|
|
|
@ -22,8 +22,14 @@ export default class NavigationService extends Service {
|
|||
}
|
||||
|
||||
// eslint-disable-next-line ghost/ember/no-observers
|
||||
@observes('session.user.accessibility')
|
||||
@observes('session.isAuthenticated', 'session.user.accessibility')
|
||||
async updateSettings() {
|
||||
// avoid fetching user before authenticated otherwise the 403 can fire
|
||||
// during authentication and cause errors during setup/signin
|
||||
if (!this.session.isAuthenticated) {
|
||||
return;
|
||||
}
|
||||
|
||||
let user = await this.session.user;
|
||||
let userSettings = JSON.parse(user.get('accessibility')) || {};
|
||||
this.settings = userSettings.navigation || Object.assign({}, DEFAULT_SETTINGS);
|
||||
|
|
Loading…
Add table
Reference in a new issue