refactor: update user and authentication schema with two-factor support

This commit is contained in:
Mauricio Siu
2025-02-16 15:32:57 -06:00
parent 90156da570
commit e1632cbdb3
33 changed files with 657 additions and 180 deletions

View File

@@ -52,7 +52,7 @@ interface Props {
export const AddUserPermissions = ({ userId }: Props) => {
const { data: projects } = api.project.all.useQuery();
const { data, refetch } = api.user.byUserId.useQuery(
const { data, refetch } = api.auth.one.useQuery(
{
userId,
},
@@ -92,7 +92,7 @@ export const AddUserPermissions = ({ userId }: Props) => {
const onSubmit = async (data: AddPermissions) => {
await mutateAsync({
userId,
id: userId,
canCreateServices: data.canCreateServices,
canCreateProjects: data.canCreateProjects,
canDeleteServices: data.canDeleteServices,

View File

@@ -104,9 +104,9 @@ export const ShowUsers = () => {
</Badge>
</TableCell>
<TableCell className="text-center">
{user.user.is2FAEnabled
{/* {user.user.is2FAEnabled
? "2FA Enabled"
: "2FA Not Enabled"}
: "2FA Not Enabled"} */}
</TableCell>
{/* <TableCell className="text-right">
<span className="text-sm text-muted-foreground">
@@ -156,7 +156,7 @@ export const ShowUsers = () => {
/>
)} */}
{user.role !== "owner" && (
{/* {user.role !== "owner" && (
<DialogAction
title="Delete User"
description="Are you sure you want to delete this user?"
@@ -185,7 +185,7 @@ export const ShowUsers = () => {
Delete User
</DropdownMenuItem>
</DialogAction>
)}
)} */}
</DropdownMenuContent>
</DropdownMenu>
</TableCell>

View File

@@ -1,5 +1,4 @@
import { AlertBlock } from "@/components/shared/alert-block";
import { CodeEditor } from "@/components/shared/code-editor";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -47,11 +46,11 @@ interface Props {
export const UpdateServerIp = ({ children, serverId }: Props) => {
const [isOpen, setIsOpen] = useState(false);
const { data } = api.admin.one.useQuery();
const { data } = api.user.get.useQuery();
const { data: ip } = api.server.publicIp.useQuery();
const { mutateAsync, isLoading, error, isError } =
api.admin.update.useMutation();
api.user.update.useMutation();
const form = useForm<Schema>({
defaultValues: {