mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(password) createHash: algo could be undefined
This commit is contained in:
parent
015ae51b19
commit
053f9d2ff9
2 changed files with 6 additions and 5 deletions
|
|
@ -36,7 +36,7 @@
|
|||
algo = config('algo');
|
||||
|
||||
sameName = username === name;
|
||||
samePass = pass === cryptPassword(algo, password);
|
||||
samePass = pass === cryptPassword(password, algo);
|
||||
|
||||
callback(sameName && samePass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
|
||||
var crypto = require('crypto');
|
||||
|
||||
module.exports = function(algo, password) {
|
||||
module.exports = function(password, algo) {
|
||||
var result, sha;
|
||||
|
||||
if (!password) {
|
||||
password = algo;
|
||||
if (!password)
|
||||
throw Error('password could not be empty!');
|
||||
|
||||
if (!algo)
|
||||
algo = 'sha512WithRSAEncryption';
|
||||
}
|
||||
|
||||
sha = crypto.createHash(algo);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue