ubuntu resolute

This commit is contained in:
Maxime KINTS
2026-05-16 23:42:06 +02:00
commit c0f607fa0b
944 changed files with 112243 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
const fs = require('fs');
const apacheMd5 = require('apache-md5');
module.exports = function(app, checkApiKey) {
app.post('/action/newuser', checkApiKey, (req, res) => {
const { username, password } = req.body;
if (!username || !password) {
return res.status(400).send('Username and password are required');
}
const passwdFilePath = '/etc/apache2/dav_svn.passwd';
const hashedPassword = apacheMd5(password); // Hacher le mot de passe au format APR1-MD5
const userLine = `${username}:${hashedPassword}`;
fs.appendFile(passwdFilePath, `${userLine}\n`, (err) => {
if (err) {
return res.status(500).send(`Error updating passwd file: ${err}`);
}
res.send(`User ${username} created successfully`);
});
});
};