Ghost/ghost/admin/app/routes/setup/done.js
Kevin Ansfield 2332f339dc
Fixed setup/done screen showing 500 when not authenticated (#19973)
closes https://linear.app/tryghost/issue/IPC-136/setupdone-route-500s-if-you-hit-it-from-a-logged-out-state-instead-of

- the setup/done route was not set up as an authenticated route so no redirect occurred when accessing it directly before logging in which in turn caused an error because the route tries to read from the session user
2024-04-02 16:43:44 +00:00

35 lines
919 B
JavaScript

import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
import {inject as service} from '@ember/service';
export default class SetupFinishingTouchesRoute extends AuthenticatedRoute {
@service feature;
@service onboarding;
@service router;
@service session;
@service settings;
@service themeManagement;
beforeModel() {
super.beforeModel(...arguments);
if (!this.session.user.isOwnerOnly) {
return;
}
if (this.feature.onboardingChecklist) {
this.onboarding.startChecklist();
return this.router.transitionTo('dashboard');
}
}
model() {
this.themeManagement.setPreviewType('homepage');
this.themeManagement.updatePreviewHtmlTask.perform();
}
deactivate() {
// rollback any unsaved setting changes when leaving
this.settings.rollbackAttributes();
}
}