From 9bc799258de5f1fc6537baf18dbee65667a5da1d Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 14 Jul 2021 13:15:59 +0100 Subject: [PATCH] Fixed more tests refs https://github.com/TryGhost/Admin/commit/8630be5a8775177b815bbc68becb760b36fafcac - referenced commit skipped current user and proxy service population when `skipAuthSuccessHandler` was set but the population is needed during setup - `skipAuthSuccessHandler` is used for skipping the post-authentication transition rather than skipping all post-auth behaviour so the the post-auth behaviour was reintroduced but put in a guard so we don't try to do it again when it's already been run --- ghost/admin/app/services/session.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ghost/admin/app/services/session.js b/ghost/admin/app/services/session.js index 86248ba037..4f2f8c4f46 100644 --- a/ghost/admin/app/services/session.js +++ b/ghost/admin/app/services/session.js @@ -56,19 +56,21 @@ export default class SessionService extends ESASessionService { } async handleAuthentication() { + if (!this.user) { + try { + await this.populateUser(); + } catch (err) { + await this.invalidate(); + } + + await this.postAuthPreparation(); + } + if (this.skipAuthSuccessHandler) { this.skipAuthSuccessHandler = false; return; } - try { - await this.populateUser(); - } catch (err) { - await this.invalidate(); - } - - await this.postAuthPreparation(); - super.handleAuthentication('home'); }