fix: disabled users are not allowed to log in
This commit is contained in:
@@ -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.",
|
||||
});
|
||||
|
||||
|
||||
@@ -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.",
|
||||
});
|
||||
|
||||
|
||||
@@ -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} />
|
||||
|
||||
@@ -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
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user