Skip to content

Commit c6934c5

Browse files
committed
removed sudo script implementations
1 parent 72fbe12 commit c6934c5

File tree

2 files changed

+4
-59
lines changed

2 files changed

+4
-59
lines changed

coder-base/apps/auth/app.js

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -346,31 +346,9 @@ exports.api_addpassword_handler = function( req, res ) {
346346
return;
347347
}
348348

349-
var spawn = require('child_process').spawn;
350349
var err=0;
351350
//device_settings.device_name = devicename;
352-
var erroutput = "";
353-
var output = "";
354-
var setpipass = process.cwd() + '/sudo_scripts/setpipass';
355-
var setpass = spawn( '/usr/bin/sudo', [setpipass] );
356-
setpass.stdout.on( 'data', function( d ) {
357-
output += d;
358-
});
359-
setpass.stderr.on( 'data', function( d ) {
360-
erroutput += d;
361-
});
362351

363-
setpass.addListener( 'exit', function( code, signal ) {
364-
err = code;
365-
366-
367-
if ( err ) {
368-
res.json({
369-
status: "error",
370-
error: erroutput
371-
});
372-
return;
373-
}
374352

375353
//TODO - Load hashed password
376354
var s = bcrypt.genSaltSync(10);
@@ -389,12 +367,6 @@ exports.api_addpassword_handler = function( req, res ) {
389367
error: "Could not save device settings."
390368
});
391369
}
392-
393-
});
394-
setpass.stdin.write(pass + '\n');
395-
setpass.stdin.write(pass + '\n');
396-
setpass.stdin.end();
397-
398370
};
399371

400372

@@ -431,31 +403,8 @@ exports.api_changepassword_handler = function( req, res ) {
431403
return;
432404
}
433405

434-
var spawn = require('child_process').spawn;
435406
var err=0;
436-
//device_settings.device_name = devicename;
437-
var erroutput = "";
438-
var output = "";
439-
var setpipass = process.cwd() + '/sudo_scripts/setpipass';
440-
var setpass = spawn( '/usr/bin/sudo', [setpipass] );
441-
setpass.stdout.on( 'data', function( d ) {
442-
output += d;
443-
});
444-
setpass.stderr.on( 'data', function( d ) {
445-
erroutput += d;
446-
});
447-
448-
setpass.addListener( 'exit', function( code, signal ) {
449-
err = code;
450-
451-
452-
if ( err ) {
453-
res.json({
454-
status: "error",
455-
error: erroutput
456-
});
457-
return;
458-
}
407+
//device_settings.device_name = devicename
459408

460409
//TODO - Load hashed password
461410
var s = bcrypt.genSaltSync(10);
@@ -475,10 +424,6 @@ exports.api_changepassword_handler = function( req, res ) {
475424
});
476425
}
477426

478-
});
479-
setpass.stdin.write(pass + '\n');
480-
setpass.stdin.write(pass + '\n');
481-
setpass.stdin.end();
482427

483428
};
484429

coder-base/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ var apphandler = function( req, res, appdir ) {
131131
};
132132

133133
var startSSLRedirect = function() {
134-
http.createServer( redirectapp ).listen( config.httpListenPort );
134+
http.createServer( redirectapp ).listen( config.httpListenPort, config.listenIP );
135135
};
136136

137137
var startSSL = function() {
@@ -146,7 +146,7 @@ var startSSL = function() {
146146
}
147147

148148
if ( privateKey !== "" && certificate !== "" ) {
149-
https.createServer({ key: privateKey, cert: certificate }, sslapp).listen( config.listenPort );
149+
https.createServer({ key: privateKey, cert: certificate }, sslapp).listen( config.listenPort, config.listenIP );
150150
} else {
151151
var spawn = require('child_process').spawn;
152152

@@ -170,7 +170,7 @@ var startSSL = function() {
170170
var loadServer = function() {
171171
privateKey = fs.readFileSync('certs/server.key').toString();
172172
certificate = fs.readFileSync('certs/server.cert').toString();
173-
https.createServer({ key: privateKey, cert: certificate }, sslapp).listen( config.listenPort );
173+
https.createServer({ key: privateKey, cert: certificate }, sslapp).listen( config.listenPort, config.listenIP );
174174
};
175175

176176
genSelfSignedCert();

0 commit comments

Comments
 (0)