diff --git a/coder-base/apps/auth/app.js b/coder-base/apps/auth/app.js index 68822f5d..48d56101 100644 --- a/coder-base/apps/auth/app.js +++ b/coder-base/apps/auth/app.js @@ -346,31 +346,9 @@ exports.api_addpassword_handler = function( req, res ) { return; } - var spawn = require('child_process').spawn; var err=0; //device_settings.device_name = devicename; - var erroutput = ""; - var output = ""; - var setpipass = process.cwd() + '/sudo_scripts/setpipass'; - var setpass = spawn( '/usr/bin/sudo', [setpipass] ); - setpass.stdout.on( 'data', function( d ) { - output += d; - }); - setpass.stderr.on( 'data', function( d ) { - erroutput += d; - }); - setpass.addListener( 'exit', function( code, signal ) { - err = code; - - - if ( err ) { - res.json({ - status: "error", - error: erroutput - }); - return; - } //TODO - Load hashed password var s = bcrypt.genSaltSync(10); @@ -389,12 +367,6 @@ exports.api_addpassword_handler = function( req, res ) { error: "Could not save device settings." }); } - - }); - setpass.stdin.write(pass + '\n'); - setpass.stdin.write(pass + '\n'); - setpass.stdin.end(); - }; @@ -431,31 +403,8 @@ exports.api_changepassword_handler = function( req, res ) { return; } - var spawn = require('child_process').spawn; var err=0; - //device_settings.device_name = devicename; - var erroutput = ""; - var output = ""; - var setpipass = process.cwd() + '/sudo_scripts/setpipass'; - var setpass = spawn( '/usr/bin/sudo', [setpipass] ); - setpass.stdout.on( 'data', function( d ) { - output += d; - }); - setpass.stderr.on( 'data', function( d ) { - erroutput += d; - }); - - setpass.addListener( 'exit', function( code, signal ) { - err = code; - - - if ( err ) { - res.json({ - status: "error", - error: erroutput - }); - return; - } + //device_settings.device_name = devicename //TODO - Load hashed password var s = bcrypt.genSaltSync(10); @@ -475,10 +424,6 @@ exports.api_changepassword_handler = function( req, res ) { }); } - }); - setpass.stdin.write(pass + '\n'); - setpass.stdin.write(pass + '\n'); - setpass.stdin.end(); }; diff --git a/coder-base/server.js b/coder-base/server.js index f7ec4f97..ac5f23aa 100644 --- a/coder-base/server.js +++ b/coder-base/server.js @@ -263,7 +263,7 @@ params.extend( redirectapp ); redirectapp.engine( 'html', cons.mustache ); redirectapp.all( /.*/, function( req, res ) { util.log( 'redirect: ' + getHost(req) + " " + config.httpsVisiblePort + " " + req.url ); - res.redirect("https://" + getHost(req) + ":" + config.httpsVisiblePort + req.url); + res.redirect("https://" + req.host + ":" + config.httpsVisiblePort + req.url); }); startSSL(); diff --git a/coder-base/sudo_scripts/reboot b/coder-base/sudo_scripts/reboot index f0d3f074..8b137891 100755 --- a/coder-base/sudo_scripts/reboot +++ b/coder-base/sudo_scripts/reboot @@ -1,2 +1 @@ -#!/bin/sh -/sbin/shutdown -r now + diff --git a/coder-base/sudo_scripts/setpipass b/coder-base/sudo_scripts/setpipass index 4b3cdcbc..96b4b06a 100755 --- a/coder-base/sudo_scripts/setpipass +++ b/coder-base/sudo_scripts/setpipass @@ -1,2 +1 @@ -#!/bin/sh -/usr/bin/passwd pi +#!/bin/sh \ No newline at end of file diff --git a/coder-base/sudo_scripts/wpa_cli_apscan b/coder-base/sudo_scripts/wpa_cli_apscan index bc4d17cf..1a248525 100755 --- a/coder-base/sudo_scripts/wpa_cli_apscan +++ b/coder-base/sudo_scripts/wpa_cli_apscan @@ -1,2 +1 @@ #!/bin/sh -/sbin/wpa_cli scan diff --git a/coder-base/sudo_scripts/wpa_cli_scan b/coder-base/sudo_scripts/wpa_cli_scan index acc643c9..1a248525 100755 --- a/coder-base/sudo_scripts/wpa_cli_scan +++ b/coder-base/sudo_scripts/wpa_cli_scan @@ -1,2 +1 @@ #!/bin/sh -/sbin/wpa_cli ap_scan 2 diff --git a/coder-base/sudo_scripts/wpa_cli_scanresults b/coder-base/sudo_scripts/wpa_cli_scanresults index 0442fda7..1a248525 100755 --- a/coder-base/sudo_scripts/wpa_cli_scanresults +++ b/coder-base/sudo_scripts/wpa_cli_scanresults @@ -1,2 +1 @@ #!/bin/sh -/sbin/wpa_cli scan_results