v1.18.x
barisusakli 9 years ago
parent 6c11709cf1
commit e55043e5ab

@ -1,16 +1,16 @@
"use strict";
var winston = require('winston'),
express = require('express'),
bodyParser = require('body-parser'),
fs = require('fs'),
path = require('path'),
less = require('less'),
async = require('async'),
uglify = require('uglify-js'),
nconf = require('nconf'),
app = express(),
server;
var winston = require('winston');
var express = require('express');
var bodyParser = require('body-parser');
var fs = require('fs');
var path = require('path');
var less = require('less');
var async = require('async');
var uglify = require('uglify-js');
var nconf = require('nconf');
var app = express();
var server;
winston.add(winston.transports.File, {
filename: 'logs/webinstall.log',
@ -22,13 +22,13 @@ winston.add(winston.transports.File, {
level: 'verbose'
});
var web = {},
scripts = [
'public/vendor/xregexp/xregexp.js',
'public/vendor/xregexp/unicode/unicode-base.js',
'public/src/utils.js',
'public/src/installer/install.js'
];
var web = {};
var scripts = [
'public/vendor/xregexp/xregexp.js',
'public/vendor/xregexp/unicode/unicode-base.js',
'public/src/utils.js',
'public/src/installer/install.js'
];
web.install = function(port) {
port = port || 4567;
@ -62,22 +62,23 @@ function setupRoutes() {
}
function welcome(req, res) {
var dbs = ['redis', 'mongo'],
databases = [];
dbs.forEach(function(el) {
databases.push({
var dbs = ['redis', 'mongo'];
var databases = dbs.map(function(el) {
return {
name: el,
questions: require('../src/database/' + el).questions
});
};
});
var defaults = require('./data/defaults');
res.render('install/index', {
databases: databases,
skipDatabaseSetup: !!nconf.get('database'),
error: res.locals.error ? true : false,
success: res.locals.success ? true : false,
values: req.body
values: req.body,
minimumPasswordLength: defaults.minimumPasswordLength
});
}
@ -104,7 +105,6 @@ function install(req, res) {
}
function launch(req, res) {
var pidFilePath = __dirname + '../pidfile';
res.json({});
server.close();
@ -146,10 +146,10 @@ function compileJS(callback) {
return callback(false);
}
var scriptPath = path.join(__dirname, '..'),
result = uglify.minify(scripts.map(function(script) {
return path.join(scriptPath, script);
}));
var scriptPath = path.join(__dirname, '..');
var result = uglify.minify(scripts.map(function(script) {
return path.join(scriptPath, script);
}));
fs.writeFile(path.join(__dirname, '../public/nodebb.min.js'), result.code, callback);

@ -44,7 +44,7 @@ $('document').ready(function() {
if ($('form .admin .error').length) {
ev.preventDefault();
$('html, body').animate({'scrollTop': '0px'}, 400);
return false;
} else {
$('#submit .fa-spin').removeClass('hide');
@ -69,6 +69,9 @@ $('document').ready(function() {
if (!utils.isPasswordValid(field)) {
parent.addClass('error');
help.html('Invalid Password.');
} else if (field.length < $('[name="admin:password"]').attr('data-minimum-length')) {
parent.addClass('error');
help.html('Password is too short.');
} else {
parent.removeClass('error');
}

@ -72,9 +72,9 @@
<div class="row input-row">
<div class="col-sm-7 col-xs-12 input-field">
<label for="admin:password">Password</label>
<input type="password" class="form-control" name="admin:password" value="<!-- IF admin:password -->{admin:password}<!-- ENDIF admin:password -->" placeholder="Password" />
<input type="password" class="form-control" name="admin:password" value="<!-- IF admin:password -->{admin:password}<!-- ENDIF admin:password -->" placeholder="Password" data-minimum-length="{minimumPasswordLength}" />
</div>
<div class="col-sm-5 help-text" data-help="Use a combination of numbers, symbols, and different cases. You can change the strictness of password creation in the Admin Control Panel."></div>
<div class="col-sm-5 help-text" data-help="Use a combination of numbers, symbols, and different cases. You can change the strictness of password creation in the Admin Control Panel. Minimum {minimumPasswordLength} characters."></div>
</div>
<div class="row input-row">
<div class="col-sm-7 col-xs-12 input-field">
@ -119,7 +119,7 @@
<div class="container <!-- IF !success -->hide<!-- ENDIF !success -->">
<p>
<h1>Congratulations! Your NodeBB has been set-up.</h1>
<button id="launch" class="btn btn-lg btn-success">Launch NodeBB <i class="fa fa-spinner fa-spin hide"></i></button>
</p>
</div>
@ -136,7 +136,7 @@
</div>
<!-- END questions -->
</div>
<!-- END databases -->
<!-- END databases -->
</div>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>

Loading…
Cancel
Save