mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-08-04 23:50:09 +02:00
feat(angular): added owasp configuration for frontend
Added configuration for owasp. Synchronize client owap configs with t…
This commit is contained in:
10
config/env/default.js
vendored
10
config/env/default.js
vendored
@@ -46,5 +46,15 @@ module.exports = {
|
||||
fileSize: 1 * 1024 * 1024 // Max file size in bytes (1 MB)
|
||||
}
|
||||
}
|
||||
},
|
||||
shared: {
|
||||
owasp: {
|
||||
allowPassphrases: true,
|
||||
maxLength: 128,
|
||||
minLength: 10,
|
||||
minPhraseLength: 20,
|
||||
minOptionalTestsToPass: 4
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var validator = require('validator');
|
||||
var validator = require('validator'),
|
||||
path = require('path'),
|
||||
config = require(path.resolve('./config/config'));
|
||||
|
||||
/**
|
||||
* Render the main application page
|
||||
*/
|
||||
exports.renderIndex = function (req, res) {
|
||||
|
||||
var safeUserObject = null;
|
||||
if (req.user) {
|
||||
safeUserObject = {
|
||||
@@ -24,7 +25,8 @@ exports.renderIndex = function (req, res) {
|
||||
}
|
||||
|
||||
res.render('modules/core/server/views/index', {
|
||||
user: JSON.stringify(safeUserObject)
|
||||
user: JSON.stringify(safeUserObject),
|
||||
sharedConfig: JSON.stringify(config.shared)
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -65,6 +65,12 @@
|
||||
|
||||
<!--Application JavaScript Files-->
|
||||
{{#each jsFiles}}<script type="text/javascript" src="{{this}}"></script>{{/each}}
|
||||
|
||||
<!--owasp config sync-->
|
||||
<script type="text/javascript">
|
||||
var sharedConfig = {{{ sharedConfig }}};
|
||||
owaspPasswordStrengthTest.config(sharedConfig.owasp);
|
||||
</script>
|
||||
|
||||
{{#if livereload}}
|
||||
<!--Livereload script rendered -->
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
function getPopoverMsg() {
|
||||
var popoverMsg = 'Please enter a passphrase or password with 10 or more characters, numbers, lowercase, uppercase, and special characters.';
|
||||
var popoverMsg = 'Please enter a passphrase or password with ' + owaspPasswordStrengthTest.configs.minLength + ' or more characters, numbers, lowercase, uppercase, and special characters.';
|
||||
|
||||
return popoverMsg;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = function () {
|
||||
}
|
||||
if (!user || !user.authenticate(password)) {
|
||||
return done(null, false, {
|
||||
message: 'Invalid username or password'
|
||||
message: 'Invalid username or password (' + (new Date()).toLocaleTimeString() + ')'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
* Module dependencies
|
||||
*/
|
||||
var mongoose = require('mongoose'),
|
||||
path = require('path'),
|
||||
config = require(path.resolve('./config/config')),
|
||||
Schema = mongoose.Schema,
|
||||
crypto = require('crypto'),
|
||||
validator = require('validator'),
|
||||
generatePassword = require('generate-password'),
|
||||
owasp = require('owasp-password-strength-test');
|
||||
|
||||
owasp.config(config.shared.owasp);
|
||||
|
||||
|
||||
/**
|
||||
* A Validation function for local strategy properties
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user