diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config/clear-credentials-by-uri.js | 16 | ||||
-rw-r--r-- | lib/config/core.js | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/config/clear-credentials-by-uri.js b/lib/config/clear-credentials-by-uri.js new file mode 100644 index 000000000..88131f7ad --- /dev/null +++ b/lib/config/clear-credentials-by-uri.js @@ -0,0 +1,16 @@ +var assert = require("assert") + +var toNerfDart = require("./nerf-dart.js") + +module.exports = clearCredentialsByURI + +function clearCredentialsByURI (uri) { + assert(uri && typeof uri === "string", "registry URL is required") + + var nerfed = toNerfDart(uri) + + this.del(nerfed + ":_authToken", "user") + this.del(nerfed + ":_password", "user") + this.del(nerfed + ":username", "user") + this.del(nerfed + ":email", "user") +} diff --git a/lib/config/core.js b/lib/config/core.js index ddd851cf7..97c17919d 100644 --- a/lib/config/core.js +++ b/lib/config/core.js @@ -227,6 +227,7 @@ Conf.prototype.setUser = require("./set-user.js") Conf.prototype.findPrefix = require("./find-prefix.js") Conf.prototype.getCredentialsByURI = require("./get-credentials-by-uri.js") Conf.prototype.setCredentialsByURI = require("./set-credentials-by-uri.js") +Conf.prototype.clearCredentialsByURI = require("./clear-credentials-by-uri.js") Conf.prototype.loadExtras = function(cb) { this.setUser(function(er) { |