| const Datastore = require('nedb-promises'); | |
| const path = require('path'); | |
| const bcrypt = require('bcryptjs'); | |
| async function fixUser() { | |
| const users = Datastore.create({ filename: path.join(__dirname, 'data', 'users.db'), autoload: true }); | |
| const email = 'johanvoncd7@gmail.com'; | |
| const newPassword = 'admin123'; | |
| const salt = await bcrypt.genSalt(10); | |
| const hashedPassword = await bcrypt.hash(newPassword, salt); | |
| const user = await users.findOne({ email }); | |
| if (user) { | |
| await users.update({ _id: user._id }, { $set: { isVerified: true, password: hashedPassword } }); | |
| console.log(`User ${email} verified and password reset to: ${newPassword}`); | |
| } else { | |
| console.log(`User ${email} not found.`); | |
| } | |
| } | |
| fixUser(); | |