diff --git a/src/node/db/API.js b/src/node/db/API.js index 09cc95afc..37fd3f161 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -431,7 +431,7 @@ exports.setPassword = function(padID, password, callback) if(ERR(err, callback)) return; //set the password - pad.setPassword(password); + pad.setPassword(password == "" ? null : password); callback(); }); diff --git a/src/node/hooks/express/apicalls.js b/src/node/hooks/express/apicalls.js index 8a9751eb5..2f9e4edf3 100644 --- a/src/node/hooks/express/apicalls.js +++ b/src/node/hooks/express/apicalls.js @@ -4,7 +4,7 @@ var formidable = require('formidable'); var apiHandler = require('../../handler/APIHandler'); //This is for making an api call, collecting all post information and passing it to the apiHandler -exports.apiCaller = function(req, res, fields) { +var apiCaller = function(req, res, fields) { res.header("Content-Type", "application/json; charset=utf-8"); apiLogger.info("REQUEST, " + req.params.func + ", " + JSON.stringify(fields)); @@ -26,6 +26,7 @@ exports.apiCaller = function(req, res, fields) { apiHandler.handle(req.params.func, fields, req, res); } +exports.apiCaller = apiCaller; exports.expressCreateServer = function (hook_name, args, cb) { //This is a api GET call, collect all post informations and pass it to the apiHandler @@ -55,4 +56,4 @@ exports.expressCreateServer = function (hook_name, args, cb) { res.end("OK"); }); }); -} \ No newline at end of file +} diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 95d195058..accc9fe6b 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -20,6 +20,7 @@ * limitations under the License. */ +var readCookie = require('./pad_utils').readCookie; var padutils = require('./pad_utils').padutils; var padeditor = require('./pad_editor').padeditor; var padsavedrevs = require('./pad_savedrevs'); @@ -236,19 +237,33 @@ var padeditbar = (function() { if ($('#readonlyinput').is(':checked')) { - var basePath = document.location.href.substring(0, document.location.href.indexOf("/p/")); - var readonlyLink = basePath + "/ro/" + clientVars.readOnlyId; - $('#embedinput').val("