Fixed htpasswd. Now produces passwords for any string

This commit is contained in:
SKP
2019-04-10 21:39:36 +02:00
committed by kexkey
parent bedd7cd703
commit 2029dcf815

View File

@@ -6,8 +6,10 @@ module.exports = async ( password ) => {
return null;
}
password = password.replace(/'/g, `'\\''`);
return await new Promise( (resolve) => {
exec('htpasswd -bnB admin '+password+' | cut -sd \':\' -f2', (error, stdout, stderr) => {
exec('htpasswd -bnB admin \''+password+'\' | cut -sd \':\' -f2', (error, stdout, stderr) => {
if (error) {
return resolve(null);
}