refactor(auth): remove deprecated add user logic

This commit is contained in:
Juan Picado @jotadeveloper 2018-01-26 07:35:07 +01:00
parent a5ac23ef14
commit 67c63892d3
No known key found for this signature in database
GPG Key ID: 18AC54485952D158
2 changed files with 1 additions and 32 deletions

View File

@ -1,14 +1,6 @@
# path to a directory with all packages
storage: ./storage
# a list of users
#
# This is deprecated, use auth plugins instead (see htpasswd below).
# users:
# admin:
# crypto.createHash('sha1').update(pass).digest('hex')
# password: a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
web:
# WebUI is enabled as default, if you want disable it, just uncomment this line
#enable: false

View File

@ -37,30 +37,6 @@ class Auth {
return p.authenticate || p.allow_access || p.allow_publish;
});
this.plugins.unshift({
verdaccio_version: pkgJson.version,
authenticate: function(user, password, cb) {
if (config.users != null
&& config.users[user] != null
&& (Crypto.createHash('sha1').update(password).digest('hex')
=== config.users[user].password)
) {
return cb(null, [user]);
}
return cb();
},
adduser: function(user, password, cb) {
if (config.users && config.users[user]) {
return cb(Error[403]('this user already exists'));
}
return cb();
},
});
const allow_action = function(action) {
return function(user, pkg, cb) {
let ok = pkg[action].reduce(function(prev, curr) {
@ -138,6 +114,7 @@ class Auth {
if (typeof(p[n]) !== 'function') {
next();
} else {
// p.add_user() execution
p[n](user, password, function(err, ok) {
if (err) return cb(err);
if (ok) return self.authenticate(user, password, cb);