Prepare v2.0.0 release

This commit is contained in:
2026-07-28 22:20:40 +01:00
parent de1469c29d
commit c643d2fb07
64 changed files with 809 additions and 1391 deletions
+5 -5
View File
@@ -20,12 +20,12 @@ module.exports = function registerAdminAccountRoutes(app, deps) {
return res.status(400).send('Name is required.');
}
if (await common.fetchDuplicateName(pool, 'users', name, req.currentUser.id)) {
if (await common.fetchDuplicateName(pool, 'a_users', name, req.currentUser.id)) {
return res.redirect('/account?message=' + encodeURIComponent('That name already exists.'));
}
const actorId = getAuditUserId(req);
const [result] = await pool.query('UPDATE users SET name = ?, modified_by = ? WHERE id = ?', [name, actorId, req.currentUser.id]);
const [result] = await pool.query('UPDATE a_users SET name = ?, modified_by = ? WHERE id = ?', [name, actorId, req.currentUser.id]);
if (!result.affectedRows) {
return res.status(404).send('User not found.');
}
@@ -42,7 +42,7 @@ module.exports = function registerAdminAccountRoutes(app, deps) {
const newPassword = String(req.body.new_password || '');
const confirmPassword = String(req.body.confirm_password || '');
const [rows] = await pool.query('SELECT id, name, username, password_hash, password_salt, password_iterations FROM users WHERE id = ? LIMIT 1', [req.currentUser.id]);
const [rows] = await pool.query('SELECT id, name, username, password_hash, password_salt, password_iterations FROM a_users WHERE id = ? LIMIT 1', [req.currentUser.id]);
const user = rows[0] || null;
if (!user) {
return res.status(404).send('User not found.');
@@ -59,10 +59,10 @@ module.exports = function registerAdminAccountRoutes(app, deps) {
const passwordRecord = hashPassword(newPassword);
await pool.query(
'UPDATE users SET password_hash = ?, password_salt = ?, password_iterations = ?, modified_by = ? WHERE id = ?',
'UPDATE a_users SET password_hash = ?, password_salt = ?, password_iterations = ?, modified_by = ? WHERE id = ?',
[passwordRecord.hash, passwordRecord.salt, passwordRecord.iterations, getAuditUserId(req), user.id]
);
await pool.query('DELETE FROM auth_sessions WHERE user_id = ?', [user.id]);
await pool.query('DELETE FROM a_sessions WHERE user_id = ?', [user.id]);
const token = await createUserSession(pool, user.id);
setSessionCookie(res, token);