마에스트로 상세화면에 암호 초기화 버튼 추가 (암호 초기화: 123456)
This commit is contained in:
@@ -255,6 +255,31 @@ export async function updateMaestro(
|
||||
return { changed: true };
|
||||
}
|
||||
|
||||
export async function resetMaestroPassword(
|
||||
maestroID: number
|
||||
): Promise<boolean> {
|
||||
const maestro = await db.maestro.findUnique({
|
||||
where: { MaestroID: maestroID },
|
||||
select: { MaestroID: true },
|
||||
});
|
||||
|
||||
if (!maestro) return false;
|
||||
|
||||
await db.$transaction(async (tx) => {
|
||||
await tx.$executeRaw`UPDATE maestro SET Password = PASSWORD('123456') WHERE MaestroID = ${maestroID}`;
|
||||
await tx.maestro_log.create({
|
||||
data: {
|
||||
Type: "reset_maestro_password",
|
||||
MaestroID: maestroID,
|
||||
LogDateTime: new Date(),
|
||||
Remark: "admin reset to 123456",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const logPageSizeOptions = [10, 20, 50] as const;
|
||||
type LogPageSize = (typeof logPageSizeOptions)[number];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user