fix: change user pwd

This commit is contained in:
熊潇 2025-04-23 11:20:57 +08:00
parent 9e5340066f
commit aa4d2b5451
2 changed files with 27 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import { sequelize } from '../modules/sequelize.ts'; import { sequelize } from '../modules/sequelize.ts';
import { User, UserInit } from '../models/user.ts'; import { User, UserInit, UserServices, Org, OrgInit } from '@kevisual/code-center-module/models';
// User.sync({ alter: true, logging: true }).then(() => { // User.sync({ alter: true, logging: true }).then(() => {
// console.log('sync user done'); // console.log('sync user done');
@ -12,8 +12,11 @@ import { User, UserInit } from '../models/user.ts';
// } // }
// } // }
export const main = async () => { export const main = async () => {
await UserInit(sequelize, null, {
await UserInit(null, null, { alter: true,
logging: false,
});
await OrgInit(sequelize, null, {
alter: true, alter: true,
logging: false, logging: false,
}); });
@ -23,4 +26,23 @@ export const main = async () => {
} }
}; };
main(); // main();
export const changeRootPassword = async () => {
await OrgInit(sequelize, null, {
alter: true,
logging: false,
});
await UserInit(sequelize, null, {
alter: true,
logging: false,
});
const user = await User.findOne({ where: { username: 'root' } });
if (user) {
await user.createPassword('123456');
await user.save();
console.log('change root password done');
process.exit(0);
}
};
changeRootPassword();

@ -1 +1 @@
Subproject commit b6bb10caca26961a31757591ad20f92a1ef95894 Subproject commit 6309a577f73fd27ab284270f56a7f83c5d8e4569