mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-11 08:55:22 +02:00
feat(password-update): enhance password update functionality across database routers
- Added confirmation password field and validation to the `UpdateDatabasePassword` component. - Refactored password update logic in MariaDB, MongoDB, MySQL, Postgres, and Redis routers to utilize database transactions for improved reliability. - Ensured consistent handling of password updates across all database types, enhancing user experience and security.
This commit is contained in:
@@ -424,13 +424,19 @@ export const postgresRouter = createTRPCRouter({
|
||||
fi
|
||||
docker exec "$CONTAINER_ID" psql -U ${databaseUser} -c "ALTER USER \\"${databaseUser}\\" WITH PASSWORD '${password}';"
|
||||
`;
|
||||
if (serverId) {
|
||||
await execAsyncRemote(serverId, command);
|
||||
} else {
|
||||
await execAsync(command, { shell: "/bin/bash" });
|
||||
}
|
||||
|
||||
await updatePostgresById(postgresId, { databasePassword: password });
|
||||
await db.transaction(async (tx) => {
|
||||
await tx
|
||||
.update(postgresTable)
|
||||
.set({ databasePassword: password })
|
||||
.where(eq(postgresTable.postgresId, postgresId));
|
||||
|
||||
if (serverId) {
|
||||
await execAsyncRemote(serverId, command);
|
||||
} else {
|
||||
await execAsync(command, { shell: "/bin/bash" });
|
||||
}
|
||||
});
|
||||
|
||||
await audit(ctx, {
|
||||
action: "update",
|
||||
|
||||
Reference in New Issue
Block a user