mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
979c3f237c
Closes #3145 - Prevent navigation to the setup screen if Ghost setup has previously been completed. - Fix templates that were incorrectly using foreach instead of each. - Add validation for minimum password length. - Fix up functional tests and split out tests for setup to a separate instance of casper because setup requires a new database. - Add a cleanDatabase task to grunt which resets the database to new.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import styleBody from 'ghost/mixins/style-body';
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
|
|
|
var SetupRoute = Ember.Route.extend(styleBody, loadingIndicator, {
|
|
classNames: ['ghost-setup'],
|
|
|
|
// 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: function () {
|
|
var self = this;
|
|
|
|
// If user is logged in, setup has already been completed.
|
|
if (this.get('session').isAuthenticated) {
|
|
this.transitionTo(Ember.SimpleAuth.routeAfterAuthentication);
|
|
return;
|
|
}
|
|
|
|
// If user is not logged in, check the state of the setup process via the API
|
|
return ic.ajax.request(this.get('ghostPaths.url').api('authentication/setup'), {
|
|
type: 'GET'
|
|
}).then(function (result) {
|
|
var setup = result.setup[0].status;
|
|
|
|
if (setup) {
|
|
return self.transitionTo('signin');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
export default SetupRoute;
|