V1.0.0-beta.16 Update
All checks were successful
continuous-integration/drone/push Build is passing

Note: We appreciate your feedback and bug reports to continue improving our platform. Thank you for your continued support!
This commit is contained in:
2024-10-27 16:48:30 +01:00
parent f83358c67d
commit 9ff4642a10
33 changed files with 3550 additions and 2058 deletions

View File

@@ -5,6 +5,7 @@ const path = require('path');
const { getUserData } = require('../Middlewares/watcherMiddleware');
const setupFilePath = path.join(__dirname, '../data', 'setup.json');
const userFilePath = path.join(__dirname, '../data', 'user.json');
const setupData = JSON.parse(fs.readFileSync(setupFilePath, 'utf-8'));
@@ -40,9 +41,19 @@ passport.deserializeUser(async (id, done) => {
if (user) {
return done(null, user);
} else {
return done(new Error('User not valid'), null);
const newUser = {
id: Date.now().toString(),
name: id,
role: 'user'
};
users.push(newUser);
fs.writeFile(userFilePath, JSON.stringify(users, null, 2), (err) => {
if (err) return done(err);
return done(null, newUser);
});
}
});
module.exports = passport;