1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Use userObj.username and not .name for ssh key lookup

Closes #2109
This commit is contained in:
Nick O'Leary 2019-04-02 14:06:37 +01:00
parent 63829b6382
commit fbec803129
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 4 additions and 2 deletions

View File

@ -35,8 +35,8 @@ var authCache = require("./git/authCache");
// TODO: DRY - red/api/editor/sshkeys ! // TODO: DRY - red/api/editor/sshkeys !
function getSSHKeyUsername(userObj) { function getSSHKeyUsername(userObj) {
var username = '__default'; var username = '__default';
if ( userObj && userObj.name ) { if ( userObj && userObj.username ) {
username = userObj.name; username = userObj.username;
} }
return username; return username;
} }

View File

@ -76,6 +76,7 @@ function runGitCommand(args,cwd,env,emit) {
}) })
} }
function runGitCommandWithAuth(args,cwd,auth,emit) { function runGitCommandWithAuth(args,cwd,auth,emit) {
log.trace("runGitCommandWithAuth "+JSON.stringify(auth).replace(/("pass.*?"\s*:\s*").+?"/g,'$1[hidden]"'));
return authResponseServer(auth).then(function(rs) { return authResponseServer(auth).then(function(rs) {
var commandEnv = clone(process.env); var commandEnv = clone(process.env);
commandEnv.GIT_ASKPASS = path.join(__dirname,"node-red-ask-pass.sh"); commandEnv.GIT_ASKPASS = path.join(__dirname,"node-red-ask-pass.sh");
@ -93,6 +94,7 @@ function runGitCommandWithAuth(args,cwd,auth,emit) {
} }
function runGitCommandWithSSHCommand(args,cwd,auth,emit) { function runGitCommandWithSSHCommand(args,cwd,auth,emit) {
log.trace("runGitCommandWithSSHCommand "+JSON.stringify(auth).replace(/("pass.*?"\s*:\s*").+?"/g,'$1[hidden]"'));
return sshResponseServer(auth).then(function(rs) { return sshResponseServer(auth).then(function(rs) {
var commandEnv = clone(process.env); var commandEnv = clone(process.env);
commandEnv.SSH_ASKPASS = path.join(__dirname,"node-red-ask-pass.sh"); commandEnv.SSH_ASKPASS = path.join(__dirname,"node-red-ask-pass.sh");