mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-04-01 02:42:23 -05:00
Fixed bug with creating users with hashed passwords
This commit is contained in:
parent
1246f12f5a
commit
ab44907dac
2 changed files with 10 additions and 1 deletions
|
@ -152,6 +152,10 @@ Config.prototype.authenticate = function(user, password) {
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
if(users.users[user].salt) {
|
||||
password += users.users[user].salt;
|
||||
}
|
||||
|
||||
return crypto.createHash('sha1').update(password).digest('hex') === users.users[user].password
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,12 @@ var Users = function() {
|
|||
Users.prototype = {
|
||||
add: function(params, callback) {
|
||||
//Hash the Password
|
||||
params.password = crypto.createHash('sha1').update(params.password).digest('hex');
|
||||
if(params.password) {
|
||||
params.password = crypto.createHash('sha1').update(params.password).digest('hex');
|
||||
}
|
||||
else if(params.password_sha) {
|
||||
params.password = params.password_sha;
|
||||
}
|
||||
|
||||
//Save
|
||||
this.users[params.name] = params;
|
||||
|
|
Loading…
Add table
Reference in a new issue