mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
30 lines
800 B
JavaScript
30 lines
800 B
JavaScript
|
import Route from '@ember/routing/route';
|
||
|
import {inject as service} from '@ember/service';
|
||
|
|
||
|
export default class UnauthenticatedRoute extends Route {
|
||
|
@service ajax;
|
||
|
@service ghostPaths;
|
||
|
@service session;
|
||
|
|
||
|
beforeModel() {
|
||
|
let authUrl = this.ghostPaths.url.api('authentication', 'setup');
|
||
|
|
||
|
// check the state of the setup process via the API
|
||
|
return this.ajax.request(authUrl).then((result) => {
|
||
|
let [setup] = result.setup;
|
||
|
|
||
|
if (setup.status !== true) {
|
||
|
this.transitionTo('setup');
|
||
|
} else {
|
||
|
return this.session.prohibitAuthentication('home');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
buildRouteInfoMetadata() {
|
||
|
return {
|
||
|
bodyClasses: ['unauthenticated-route']
|
||
|
};
|
||
|
}
|
||
|
}
|