* Allow SSHPMPT.ASC for displaying SSH/secure app info/instructions

This commit is contained in:
Bryan Ashby 2015-10-22 11:04:50 -06:00
parent 4a22ce0924
commit 93cff52c1f
2 changed files with 26 additions and 5 deletions

View File

@ -77,7 +77,9 @@ function getDefaultConfig() {
invalidUsernames : [],
groups : [ 'users', 'sysops' ], // built in groups
defaultGroups : [ 'users' ] // default groups new users belong to
defaultGroups : [ 'users' ], // default groups new users belong to
newUserNames : [ 'new', 'apply' ], // Names reserved for applying
},
// :TODO: better name for "defaults"... which is redundant here!

View File

@ -8,6 +8,7 @@ var Log = require('../logger.js').log;
var ServerModule = require('../server_module.js').ServerModule;
var userLogin = require('../user_login.js').userLogin;
var enigVersion = require('../../package.json').version;
var theme = require('../theme.js');
var ssh2 = require('ssh2');
var fs = require('fs');
@ -63,6 +64,8 @@ function SSHClient(clientConn) {
// :TODO: Can we display somthing here?
termConnection();
return;
} else {
return ctx.reject(SSHClient.ValidAuthMethods);
}
} else {
ctx.accept();
@ -73,6 +76,8 @@ function SSHClient(clientConn) {
return ctx.reject(SSHClient.ValidAuthMethods);
}
console.log(ctx.method)
if(0 === username.length) {
// :TODO: can we display something here?
return ctx.reject();
@ -89,12 +94,26 @@ function SSHClient(clientConn) {
// :TODO: can we display something here?
termConnection();
} else {
interactivePrompt.prompt = 'Access denied\n' + ctx.username + '\'s password: ';
if(loginAttempts >= conf.config.general.loginAttempts) {
termConnection();
} else {
var artOpts = {
client : self,
name : 'SSHPMPT.ASC',
readSauce : false,
};
theme.getThemeArt(artOpts, function gotArt(err, artInfo) {
if(err) {
interactivePrompt.prompt = 'Access denied\n' + ctx.username + '\'s password: ';
} else {
var newUserNameList = '"' + (conf.config.users.newUserNames || []).join(', ') + '"';
interactivePrompt.prompt =
'Access denied\n' +
artInfo.data.format( { newUserNames : newUserNameList } ) +
'\n' + ctx.username + '\'s password: ';
}
return ctx.prompt(interactivePrompt, retryPrompt);
});
}
}
} else {