mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
no issue - add ember-suave dependency - upgrade grunt-jscs dependency - add a new .jscsrc for the client's tests directory that extends from client's base .jscsrc - separate client tests in Gruntfile jscs task so they pick up the test's .jscsrc - standardize es6 usage across client
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import Ember from 'ember';
|
|
import {request as ajax} from 'ic-ajax';
|
|
import Configuration from 'ember-simple-auth/configuration';
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
|
|
const {Route, inject} = Ember;
|
|
|
|
export default Route.extend(styleBody, {
|
|
titleToken: 'Setup',
|
|
|
|
classNames: ['ghost-setup'],
|
|
|
|
ghostPaths: inject.service('ghost-paths'),
|
|
session: inject.service(),
|
|
|
|
// use the beforeModel hook to check to see whether or not setup has been
|
|
// previously completed. If it has, stop the transition into the setup page.
|
|
beforeModel() {
|
|
if (this.get('session.isAuthenticated')) {
|
|
this.transitionTo(Configuration.routeIfAlreadyAuthenticated);
|
|
return;
|
|
}
|
|
|
|
// If user is not logged in, check the state of the setup process via the API
|
|
return ajax(this.get('ghostPaths.url').api('authentication/setup'), {
|
|
type: 'GET'
|
|
}).then((result) => {
|
|
let setup = result.setup[0].status;
|
|
|
|
if (setup) {
|
|
return this.transitionTo('signin');
|
|
}
|
|
});
|
|
},
|
|
|
|
deactivate() {
|
|
this._super(...arguments);
|
|
this.controllerFor('setup/two').set('password', '');
|
|
}
|
|
});
|