Skip to content
Snippets Groups Projects
Commit 91311c00 authored by rswindell's avatar rswindell
Browse files

Added alerts about passwords shared among > 2 user accounts.

parent 3ab8afd7
Branches
Tags
No related merge requests found
...@@ -91,6 +91,7 @@ var tests = { ...@@ -91,6 +91,7 @@ var tests = {
var output = []; var output = [];
var usr = new User; var usr = new User;
var lastuser = system.lastuser; var lastuser = system.lastuser;
var password_list = {};
for(var u = 1; u <= lastuser; u++) { for(var u = 1; u <= lastuser; u++) {
usr.number = u; usr.number = u;
if(usr == null) if(usr == null)
...@@ -101,12 +102,27 @@ var tests = { ...@@ -101,12 +102,27 @@ var tests = {
output.push(format("User #%-4u has no password", usr.number)); output.push(format("User #%-4u has no password", usr.number));
continue; continue;
} }
if(!password_list[usr.security.password])
password_list[usr.security.password] = [];
password_list[usr.security.password].push(u);
if(system.min_password_length
&& usr.security.password.length < system.min_password_length)
output.push(format("User #-4u has a password length (%u) < the minimum: %u"
, usr.number
, usr.security.password.length
, system.min_password_length));
if(!system.trashcan("password", usr.security.password)) if(!system.trashcan("password", usr.security.password))
continue; continue;
output.push(format("User #%-4u has a disallowed password%s" output.push(format("User #%-4u has a disallowed password%s"
, usr.number , usr.number
, options.verbose ? (': ' + usr.security.password) : '')); , options.verbose ? (': ' + usr.security.password) : ''));
} }
for(var p in password_list) {
if(password_list[p].length > 2)
output.push("Password "
+ ( options.verbose ? (p + ' '): '')
+ "shared between " + password_list[p].length + " users: " + password_list[p]);
}
return output; return output;
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment