mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Pre-populate setup values from config
no issue - Check for title, user_name and user_email in the top level of config. - If they exist, return them as part of the setup check, so that the setup screen can be prepopulated
This commit is contained in:
parent
e6fe1c672c
commit
bd3234d207
3 changed files with 22 additions and 5 deletions
|
@ -31,10 +31,23 @@ export default Route.extend(styleBody, {
|
||||||
// If user is not logged in, check the state of the setup process via the API
|
// If user is not logged in, check the state of the setup process via the API
|
||||||
return this.get('ajax').request(authUrl)
|
return this.get('ajax').request(authUrl)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
let setup = result.setup[0].status;
|
let [setup] = result.setup;
|
||||||
|
|
||||||
if (setup) {
|
if (setup.status) {
|
||||||
return this.transitionTo('signin');
|
return this.transitionTo('signin');
|
||||||
|
} else {
|
||||||
|
let controller = this.controllerFor('setup/two');
|
||||||
|
if (setup.title) {
|
||||||
|
controller.set('blogTitle', setup.title.replace(/'/gim, '\''));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setup.name) {
|
||||||
|
controller.set('name', setup.name.replace(/'/gim, '\''));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setup.email) {
|
||||||
|
controller.set('email', setup.email);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -377,7 +377,13 @@ authentication = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatResponse(isSetup) {
|
function formatResponse(isSetup) {
|
||||||
return {setup: [{status: isSetup}]};
|
return {setup: [{
|
||||||
|
status: isSetup,
|
||||||
|
// Pre-populate from config if, and only if the values exist in config.
|
||||||
|
title: config.title || undefined,
|
||||||
|
name: config.user_name || undefined,
|
||||||
|
email: config.user_email || undefined
|
||||||
|
}]};
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
|
|
|
@ -136,8 +136,6 @@ describe('Database Migration (special functions)', function () {
|
||||||
permissions[34].name.should.eql('Delete clients');
|
permissions[34].name.should.eql('Delete clients');
|
||||||
permissions[34].should.be.AssignedToRoles(['Administrator', 'Editor', 'Author']);
|
permissions[34].should.be.AssignedToRoles(['Administrator', 'Editor', 'Author']);
|
||||||
|
|
||||||
console.log(permissions[38]);
|
|
||||||
|
|
||||||
// Subscribers
|
// Subscribers
|
||||||
permissions[35].name.should.eql('Browse subscribers');
|
permissions[35].name.should.eql('Browse subscribers');
|
||||||
permissions[35].should.be.AssignedToRoles(['Administrator']);
|
permissions[35].should.be.AssignedToRoles(['Administrator']);
|
||||||
|
|
Loading…
Reference in a new issue