mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
feat: adduser created with htpasswd
This commit is contained in:
parent
ccd3d26059
commit
223d6492d4
2 changed files with 7 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
var crypto = require('crypto')
|
||||
var crypt3 = require('./crypt3')
|
||||
var md5 = require('apache-md5')
|
||||
var locker = require('../../file-locking')
|
||||
|
||||
// this function neither unlocks file nor closes it
|
||||
|
@ -32,10 +33,12 @@ function verify_password(user, passwd, hash) {
|
|||
return passwd === hash.substr(7)
|
||||
} else if (hash.indexOf('{SHA}') === 0) {
|
||||
return crypto.createHash('sha1').update(passwd, 'binary').digest('base64') === hash.substr(5)
|
||||
} else if (crypt3) {
|
||||
return crypt3(passwd, hash) === hash
|
||||
} else {
|
||||
return false
|
||||
return (
|
||||
// for backwards compatibility, first check md5 then check crypt3
|
||||
md5(passwd, hash) === hash ||
|
||||
crypt3(passwd, hash) === hash
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"JSONStream": "^1.1.1",
|
||||
"apache-md5": "^1.1.2",
|
||||
"async": "^2.0.1",
|
||||
"body-parser": "^1.15.0",
|
||||
"bunyan": "^1.8.0",
|
||||
|
|
Loading…
Reference in a new issue