fix: disabled users are not allowed to log in

This commit is contained in:
oiov
2025-08-04 10:20:21 +08:00
parent ad0c4b2b6e
commit 97097b143a
5 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ import { RadialShapeChart } from "./api-key-active-chart";
import { LineChartMultiple } from "./line-chart-multiple";
export const metadata = constructMetadata({
title: "Admin WR.DO",
title: "Admin",
description: "Admin page for only admin management.",
});
+1 -1
View File
@@ -7,7 +7,7 @@ import { DashboardHeader } from "@/components/dashboard/header";
import UsersList from "./user-list";
export const metadata = constructMetadata({
title: "User Management  WR.DO",
title: "User Management",
description: "List and manage all users.",
});
+1 -1
View File
@@ -263,7 +263,7 @@ export default function UsersList({ user }: UrlListProps) {
</Badge>
</TableCell>
<TableCell className="col-span-1 hidden justify-center sm:flex">
<Switch defaultChecked={user.active === 1} />
<Switch defaultChecked={user.active === 1} disabled />
</TableCell>
<TableCell className="col-span-1 hidden justify-center sm:flex">
<TimeAgoIntl date={user.updatedAt as Date} />
+3
View File
@@ -36,6 +36,9 @@ export async function POST(req: NextRequest) {
});
return Response.json(newUser, { status: 200 });
} else {
if (user.active === 0) {
return Response.json(null, { status: 403 });
}
const passwordCorrect = verifyPassword(password, user.password || "");
if (passwordCorrect) {
return Response.json(user, { status: 200 });
+1 -1
View File
File diff suppressed because one or more lines are too long