mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-30 23:55:49 +02:00
update all
This commit is contained in:
parent
ea24759bb3
commit
f07e8d08c3
63 changed files with 380 additions and 381 deletions
|
@ -458,6 +458,7 @@
|
||||||
"createdAt": "Created At",
|
"createdAt": "Created At",
|
||||||
"proxyErrorInvalidHeader": "Invalid custom Host Header value. Use domain name format, or save empty to unset custom Host Header.",
|
"proxyErrorInvalidHeader": "Invalid custom Host Header value. Use domain name format, or save empty to unset custom Host Header.",
|
||||||
"proxyErrorTls": "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name.",
|
"proxyErrorTls": "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name.",
|
||||||
|
"proxyEnableSSL": "Enable SSL (https)",
|
||||||
"targetErrorFetch": "Failed to fetch targets",
|
"targetErrorFetch": "Failed to fetch targets",
|
||||||
"targetErrorFetchDescription": "An error occurred while fetching targets",
|
"targetErrorFetchDescription": "An error occurred while fetching targets",
|
||||||
"siteErrorFetch": "Failed to fetch resource",
|
"siteErrorFetch": "Failed to fetch resource",
|
||||||
|
@ -850,7 +851,7 @@
|
||||||
"otpEmail": "One-Time Password (OTP)",
|
"otpEmail": "One-Time Password (OTP)",
|
||||||
"otpEmailSubmit": "Submit OTP",
|
"otpEmailSubmit": "Submit OTP",
|
||||||
"backToEmail": "Back to Email",
|
"backToEmail": "Back to Email",
|
||||||
"noSupportKey": "Server is running without a supporter key.<br/>Consider supporting the project!",
|
"noSupportKey": "Server is running without a supporter key. Consider supporting the project!",
|
||||||
"accessDenied": "Access Denied",
|
"accessDenied": "Access Denied",
|
||||||
"accessDeniedDescription": "You're not allowed to access this resource. If this is a mistake, please contact the administrator.",
|
"accessDeniedDescription": "You're not allowed to access this resource. If this is a mistake, please contact the administrator.",
|
||||||
"accessTokenError": "Error checking access token",
|
"accessTokenError": "Error checking access token",
|
||||||
|
@ -1059,5 +1060,8 @@
|
||||||
"copyText": "Copy text",
|
"copyText": "Copy text",
|
||||||
"copyTextFailed": "Failed to copy text: ",
|
"copyTextFailed": "Failed to copy text: ",
|
||||||
"copyTextClipboard": "Copy to clipboard",
|
"copyTextClipboard": "Copy to clipboard",
|
||||||
"inviteErrorInvalidConfirmation": "Invalid confirmation"
|
"inviteErrorInvalidConfirmation": "Invalid confirmation",
|
||||||
|
"passwordRequired": "Password is required",
|
||||||
|
"allowAll": "Allow All",
|
||||||
|
"permissionsAllowAll": "Allow All Permissions"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import createNextIntlPlugin from 'next-intl/plugin';
|
import createNextIntlPlugin from "next-intl/plugin";
|
||||||
|
|
||||||
const withNextIntl = createNextIntlPlugin();
|
const withNextIntl = createNextIntlPlugin();
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
eslint: {
|
eslint: {
|
||||||
ignoreDuringBuilds: true
|
ignoreDuringBuilds: true
|
||||||
},
|
},
|
||||||
output: 'standalone'
|
output: "standalone"
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withNextIntl(nextConfig);
|
export default withNextIntl(nextConfig);
|
||||||
|
|
|
@ -148,7 +148,7 @@ export default function InvitationsTable({
|
||||||
dialog={
|
dialog={
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<p>
|
<p>
|
||||||
{t('inviteQuestionRemove', {email: selectedInvitation?.email || ''})}
|
{t('inviteQuestionRemove', {email: selectedInvitation?.email})}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{t('inviteMessageRemove')}
|
{t('inviteMessageRemove')}
|
||||||
|
|
|
@ -60,13 +60,13 @@ export default function RegenerateInvitationForm({
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
const validForOptions = [
|
const validForOptions = [
|
||||||
{ hours: 24, name: t('day', { count: 1 }) },
|
{ hours: 24, name: t('day', {count: 1}) },
|
||||||
{ hours: 48, name: t('day', { count: 2 }) },
|
{ hours: 48, name: t('day', {count: 2}) },
|
||||||
{ hours: 72, name: t('day', { count: 3 }) },
|
{ hours: 72, name: t('day', {count: 3}) },
|
||||||
{ hours: 96, name: t('day', { count: 4 }) },
|
{ hours: 96, name: t('day', {count: 4}) },
|
||||||
{ hours: 120, name: t('day', { count: 5 }) },
|
{ hours: 120, name: t('day', {count: 5}) },
|
||||||
{ hours: 144, name: t('day', { count: 6 }) },
|
{ hours: 144, name: t('day', {count: 6}) },
|
||||||
{ hours: 168, name: t('day', { count: 7 }) }
|
{ hours: 168, name: t('day', {count: 7}) }
|
||||||
];
|
];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -177,7 +177,7 @@ export default function RegenerateInvitationForm({
|
||||||
{!inviteLink ? (
|
{!inviteLink ? (
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
{t('inviteQuestionRegenerate', {email: invitation?.email || ''})}
|
{t('inviteQuestionRegenerate', {email: invitation?.email})}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center space-x-2 mt-4">
|
<div className="flex items-center space-x-2 mt-4">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
|
@ -222,7 +222,7 @@ export default function UsersTable({ users: u }: UsersTableProps) {
|
||||||
toast({
|
toast({
|
||||||
variant: "default",
|
variant: "default",
|
||||||
title: t('userOrgRemoved'),
|
title: t('userOrgRemoved'),
|
||||||
description: t('userOrgRemovedDescription', {email: selectedUser.email}) // FIXME
|
description: t('userOrgRemovedDescription', {email: selectedUser.email})
|
||||||
});
|
});
|
||||||
|
|
||||||
setUsers((prev) =>
|
setUsers((prev) =>
|
||||||
|
@ -244,7 +244,7 @@ export default function UsersTable({ users: u }: UsersTableProps) {
|
||||||
dialog={
|
dialog={
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<p>
|
<p>
|
||||||
{t('userQuestionOrgRemove', {email: selectedUser?.email || selectedUser?.name || selectedUser?.username})} // FIXME
|
{t('userQuestionOrgRemove', {email: selectedUser?.email || selectedUser?.name || selectedUser?.username})}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -60,15 +60,6 @@ interface IdpOption {
|
||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatIdpType = (type: string) => {
|
|
||||||
switch (type.toLowerCase()) {
|
|
||||||
case "oidc":
|
|
||||||
return "Generic OAuth2/OIDC provider.";
|
|
||||||
default:
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const { orgId } = useParams();
|
const { orgId } = useParams();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -104,6 +95,15 @@ export default function Page() {
|
||||||
idpId: z.string().min(1, { message: t('idpSelectPlease') })
|
idpId: z.string().min(1, { message: t('idpSelectPlease') })
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const formatIdpType = (type: string) => {
|
||||||
|
switch (type.toLowerCase()) {
|
||||||
|
case "oidc":
|
||||||
|
return t('idpGenericOidc');
|
||||||
|
default:
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const validFor = [
|
const validFor = [
|
||||||
{ hours: 24, name: t('day', {count: 1}) },
|
{ hours: 24, name: t('day', {count: 1}) },
|
||||||
{ hours: 48, name: t('day', {count: 2}) },
|
{ hours: 48, name: t('day', {count: 2}) },
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default function OrgApiKeysTable({
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="ghost" className="h-8 w-8 p-0">
|
<Button variant="ghost" className="h-8 w-8 p-0">
|
||||||
<span className="sr-only">Open menu</span>
|
<span className="sr-only">{t('openMenu')}</span>
|
||||||
<MoreHorizontal className="h-4 w-4" />
|
<MoreHorizontal className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
|
|
@ -93,7 +93,7 @@ export default function GeneralPage() {
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
title: t('orgErrorDelete'),
|
title: t('orgErrorDelete'),
|
||||||
description: formatAxiosError(err,t('orgErrorDeleteMessage'))
|
description: formatAxiosError(err, t('orgErrorDeleteMessage'))
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingDelete(false);
|
setLoadingDelete(false);
|
||||||
|
@ -121,7 +121,7 @@ export default function GeneralPage() {
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
title: t('orgErrorFetch'),
|
title: t('orgErrorFetch'),
|
||||||
description: formatAxiosError(err,t('orgErrorFetchMessage'))
|
description: formatAxiosError(err, t('orgErrorFetchMessage'))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ export default function GeneralPage() {
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
title: t('orgErrorUpdate'),
|
title: t('orgErrorUpdate'),
|
||||||
description: formatAxiosError(e,t('orgErrorUpdateMessage'))
|
description: formatAxiosError(e, t('orgErrorUpdateMessage'))
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
} from "@app/components/InfoSection";
|
} from "@app/components/InfoSection";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Switch } from "@app/components/ui/switch";
|
import { Switch } from "@app/components/ui/switch";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type ResourceInfoBoxType = {};
|
type ResourceInfoBoxType = {};
|
||||||
|
|
||||||
|
|
|
@ -162,10 +162,9 @@ export default function ResourceAuthenticationPage() {
|
||||||
rolesResponse.data.data.roles
|
rolesResponse.data.data.roles
|
||||||
.map((role) => ({
|
.map((role) => ({
|
||||||
id: role.roleId.toString(),
|
id: role.roleId.toString(),
|
||||||
text: role.name,
|
text: role.name
|
||||||
isAdmin: role.isAdmin
|
|
||||||
}))
|
}))
|
||||||
.filter((role) => !role.isAdmin)
|
.filter((role) => role.text !== "Admin")
|
||||||
);
|
);
|
||||||
|
|
||||||
usersRolesForm.setValue(
|
usersRolesForm.setValue(
|
||||||
|
@ -173,10 +172,9 @@ export default function ResourceAuthenticationPage() {
|
||||||
resourceRolesResponse.data.data.roles
|
resourceRolesResponse.data.data.roles
|
||||||
.map((i) => ({
|
.map((i) => ({
|
||||||
id: i.roleId.toString(),
|
id: i.roleId.toString(),
|
||||||
text: i.name,
|
text: i.name
|
||||||
isAdmin: i.isAdmin
|
|
||||||
}))
|
}))
|
||||||
.filter((role) => !role.isAdmin)
|
.filter((role) => role.text !== "Admin")
|
||||||
);
|
);
|
||||||
|
|
||||||
setAllUsers(
|
setAllUsers(
|
||||||
|
|
|
@ -67,45 +67,6 @@ import {
|
||||||
import { SwitchInput } from "@app/components/SwitchInput";
|
import { SwitchInput } from "@app/components/SwitchInput";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const GeneralFormSchema = z
|
|
||||||
.object({
|
|
||||||
subdomain: z.string().optional(),
|
|
||||||
name: z.string().min(1).max(255),
|
|
||||||
proxyPort: z.number().optional(),
|
|
||||||
http: z.boolean(),
|
|
||||||
isBaseDomain: z.boolean().optional(),
|
|
||||||
domainId: z.string().optional()
|
|
||||||
})
|
|
||||||
.refine(
|
|
||||||
(data) => {
|
|
||||||
if (!data.http) {
|
|
||||||
return z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.min(1)
|
|
||||||
.max(65535)
|
|
||||||
.safeParse(data.proxyPort).success;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: "Invalid port number",
|
|
||||||
path: ["proxyPort"]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.refine(
|
|
||||||
(data) => {
|
|
||||||
if (data.http && !data.isBaseDomain) {
|
|
||||||
return subdomainSchema.safeParse(data.subdomain).success;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: "Invalid subdomain",
|
|
||||||
path: ["subdomain"]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const TransferFormSchema = z.object({
|
const TransferFormSchema = z.object({
|
||||||
siteId: z.number()
|
siteId: z.number()
|
||||||
});
|
});
|
||||||
|
@ -140,6 +101,45 @@ export default function GeneralForm() {
|
||||||
resource.isBaseDomain ? "basedomain" : "subdomain"
|
resource.isBaseDomain ? "basedomain" : "subdomain"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const GeneralFormSchema = z
|
||||||
|
.object({
|
||||||
|
subdomain: z.string().optional(),
|
||||||
|
name: z.string().min(1).max(255),
|
||||||
|
proxyPort: z.number().optional(),
|
||||||
|
http: z.boolean(),
|
||||||
|
isBaseDomain: z.boolean().optional(),
|
||||||
|
domainId: z.string().optional()
|
||||||
|
})
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
if (!data.http) {
|
||||||
|
return z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.min(1)
|
||||||
|
.max(65535)
|
||||||
|
.safeParse(data.proxyPort).success;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: t('proxyErrorInvalidPort'),
|
||||||
|
path: ["proxyPort"]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
if (data.http && !data.isBaseDomain) {
|
||||||
|
return subdomainSchema.safeParse(data.subdomain).success;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: t('subdomainErrorInvalid'),
|
||||||
|
path: ["subdomain"]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const form = useForm<GeneralFormValues>({
|
const form = useForm<GeneralFormValues>({
|
||||||
resolver: zodResolver(GeneralFormSchema),
|
resolver: zodResolver(GeneralFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
@ -93,45 +93,6 @@ type LocalTarget = Omit<
|
||||||
"protocol"
|
"protocol"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
const proxySettingsSchema = z.object({
|
|
||||||
setHostHeader: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.refine(
|
|
||||||
(data) => {
|
|
||||||
if (data) {
|
|
||||||
return tlsNameSchema.safeParse(data).success;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: "Invalid custom Host Header value. Use domain name format, or save empty to unset custom Host Header."
|
|
||||||
}
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
const tlsSettingsSchema = z.object({
|
|
||||||
ssl: z.boolean(),
|
|
||||||
tlsServerName: z
|
|
||||||
.string()
|
|
||||||
.optional()
|
|
||||||
.refine(
|
|
||||||
(data) => {
|
|
||||||
if (data) {
|
|
||||||
return tlsNameSchema.safeParse(data).success;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name."
|
|
||||||
}
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
type ProxySettingsValues = z.infer<typeof proxySettingsSchema>;
|
|
||||||
type TlsSettingsValues = z.infer<typeof tlsSettingsSchema>;
|
|
||||||
type TargetsSettingsValues = z.infer<typeof targetsSettingsSchema>;
|
|
||||||
|
|
||||||
export default function ReverseProxyTargets(props: {
|
export default function ReverseProxyTargets(props: {
|
||||||
params: Promise<{ resourceId: number }>;
|
params: Promise<{ resourceId: number }>;
|
||||||
}) {
|
}) {
|
||||||
|
@ -154,6 +115,45 @@ export default function ReverseProxyTargets(props: {
|
||||||
const [isAdvancedOpen, setIsAdvancedOpen] = useState(false);
|
const [isAdvancedOpen, setIsAdvancedOpen] = useState(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const proxySettingsSchema = z.object({
|
||||||
|
setHostHeader: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
if (data) {
|
||||||
|
return tlsNameSchema.safeParse(data).success;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: t('proxyErrorInvalidHeader')
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
const tlsSettingsSchema = z.object({
|
||||||
|
ssl: z.boolean(),
|
||||||
|
tlsServerName: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
if (data) {
|
||||||
|
return tlsNameSchema.safeParse(data).success;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: t('proxyErrorTls')
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
type ProxySettingsValues = z.infer<typeof proxySettingsSchema>;
|
||||||
|
type TlsSettingsValues = z.infer<typeof tlsSettingsSchema>;
|
||||||
|
type TargetsSettingsValues = z.infer<typeof targetsSettingsSchema>;
|
||||||
|
|
||||||
const addTargetForm = useForm({
|
const addTargetForm = useForm({
|
||||||
resolver: zodResolver(addTargetSchema),
|
resolver: zodResolver(addTargetSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
@ -583,7 +583,7 @@ export default function ReverseProxyTargets(props: {
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SwitchInput
|
<SwitchInput
|
||||||
id="ssl-toggle"
|
id="ssl-toggle"
|
||||||
label="Enable SSL (https)"
|
label={t('proxyEnableSSL')}
|
||||||
defaultChecked={
|
defaultChecked={
|
||||||
field.value
|
field.value
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,6 @@ function isIPInSubnet(subnet: string, ip: string): boolean {
|
||||||
// Split subnet into IP and mask parts
|
// Split subnet into IP and mask parts
|
||||||
const [subnetIP, maskBits] = subnet.split("/");
|
const [subnetIP, maskBits] = subnet.split("/");
|
||||||
const mask = parseInt(maskBits);
|
const mask = parseInt(maskBits);
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
if (mask < 0 || mask > 32) {
|
if (mask < 0 || mask > 32) {
|
||||||
throw new Error(t('subnetMaskErrorInvalid'));
|
throw new Error(t('subnetMaskErrorInvalid'));
|
||||||
|
|
|
@ -102,7 +102,8 @@ export default function ResourceRules(props: {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
const RuleAction = {
|
|
||||||
|
RuleAction = {
|
||||||
ACCEPT: t('alwaysAllow'),
|
ACCEPT: t('alwaysAllow'),
|
||||||
DROP: t('alwaysDeny')
|
DROP: t('alwaysDeny')
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
@ -62,7 +62,7 @@ import { cn } from "@app/lib/cn";
|
||||||
import { SquareArrowOutUpRight } from "lucide-react";
|
import { SquareArrowOutUpRight } from "lucide-react";
|
||||||
import CopyTextBox from "@app/components/CopyTextBox";
|
import CopyTextBox from "@app/components/CopyTextBox";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const baseResourceFormSchema = z.object({
|
const baseResourceFormSchema = z.object({
|
||||||
name: z.string().min(1).max(255),
|
name: z.string().min(1).max(255),
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { cache } from "react";
|
||||||
import { GetOrgResponse } from "@server/routers/org";
|
import { GetOrgResponse } from "@server/routers/org";
|
||||||
import OrgProvider from "@app/providers/OrgProvider";
|
import OrgProvider from "@app/providers/OrgProvider";
|
||||||
import ResourcesSplashCard from "./ResourcesSplashCard";
|
import ResourcesSplashCard from "./ResourcesSplashCard";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
type ResourcesPageProps = {
|
type ResourcesPageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import CopyToClipboard from "@app/components/CopyToClipboard";
|
import CopyToClipboard from "@app/components/CopyToClipboard";
|
||||||
import CopyTextBox from "@app/components/CopyTextBox";
|
import CopyTextBox from "@app/components/CopyTextBox";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface AccessTokenSectionProps {
|
interface AccessTokenSectionProps {
|
||||||
token: string;
|
token: string;
|
||||||
|
|
|
@ -66,7 +66,7 @@ import {
|
||||||
CollapsibleTrigger
|
CollapsibleTrigger
|
||||||
} from "@app/components/ui/collapsible";
|
} from "@app/components/ui/collapsible";
|
||||||
import AccessTokenSection from "./AccessTokenUsage";
|
import AccessTokenSection from "./AccessTokenUsage";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type FormProps = {
|
type FormProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
@ -74,15 +74,6 @@ type FormProps = {
|
||||||
onCreated?: (result: ShareLinkRow) => void;
|
onCreated?: (result: ShareLinkRow) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formSchema = z.object({
|
|
||||||
resourceId: z.number({ message: "Please select a resource" }),
|
|
||||||
resourceName: z.string(),
|
|
||||||
resourceUrl: z.string(),
|
|
||||||
timeUnit: z.string(),
|
|
||||||
timeValue: z.coerce.number().int().positive().min(1),
|
|
||||||
title: z.string().optional()
|
|
||||||
});
|
|
||||||
|
|
||||||
export default function CreateShareLinkForm({
|
export default function CreateShareLinkForm({
|
||||||
open,
|
open,
|
||||||
setOpen,
|
setOpen,
|
||||||
|
@ -100,6 +91,7 @@ export default function CreateShareLinkForm({
|
||||||
const [neverExpire, setNeverExpire] = useState(false);
|
const [neverExpire, setNeverExpire] = useState(false);
|
||||||
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
const [resources, setResources] = useState<
|
const [resources, setResources] = useState<
|
||||||
{
|
{
|
||||||
|
@ -110,7 +102,14 @@ export default function CreateShareLinkForm({
|
||||||
}[]
|
}[]
|
||||||
>([]);
|
>([]);
|
||||||
|
|
||||||
const t = useTranslations();
|
const formSchema = z.object({
|
||||||
|
resourceId: z.number({ message: t('shareErrorSelectResource') }),
|
||||||
|
resourceName: z.string(),
|
||||||
|
resourceUrl: z.string(),
|
||||||
|
timeUnit: z.string(),
|
||||||
|
timeValue: z.coerce.number().int().positive().min(1),
|
||||||
|
title: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
const timeUnits = [
|
const timeUnits = [
|
||||||
{ unit: "minutes", name: t('minutes') },
|
{ unit: "minutes", name: t('minutes') },
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
ColumnDef,
|
ColumnDef,
|
||||||
} from "@tanstack/react-table";
|
} from "@tanstack/react-table";
|
||||||
import { DataTable } from "@app/components/ui/data-table";
|
import { DataTable } from "@app/components/ui/data-table";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface DataTableProps<TData, TValue> {
|
interface DataTableProps<TData, TValue> {
|
||||||
columns: ColumnDef<TData, TValue>[];
|
columns: ColumnDef<TData, TValue>[];
|
||||||
|
|
|
@ -33,7 +33,7 @@ import { ListAccessTokensResponse } from "@server/routers/accessToken";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import CreateShareLinkForm from "./CreateShareLinkForm";
|
import CreateShareLinkForm from "./CreateShareLinkForm";
|
||||||
import { constructShareLink } from "@app/lib/shareLinks";
|
import { constructShareLink } from "@app/lib/shareLinks";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export type ShareLinkRow = {
|
export type ShareLinkRow = {
|
||||||
accessTokenId: string;
|
accessTokenId: string;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import OrgProvider from "@app/providers/OrgProvider";
|
||||||
import { ListAccessTokensResponse } from "@server/routers/accessToken";
|
import { ListAccessTokensResponse } from "@server/routers/accessToken";
|
||||||
import ShareLinksTable, { ShareLinkRow } from "./ShareLinksTable";
|
import ShareLinksTable, { ShareLinkRow } from "./ShareLinksTable";
|
||||||
import ShareableLinksSplash from "./ShareLinksSplash";
|
import ShareableLinksSplash from "./ShareLinksSplash";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
type ShareLinksPageProps = {
|
type ShareLinksPageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
|
|
|
@ -50,26 +50,7 @@ import {
|
||||||
CollapsibleTrigger
|
CollapsibleTrigger
|
||||||
} from "@app/components/ui/collapsible";
|
} from "@app/components/ui/collapsible";
|
||||||
import LoaderPlaceholder from "@app/components/PlaceHolderLoader";
|
import LoaderPlaceholder from "@app/components/PlaceHolderLoader";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const createSiteFormSchema = z.object({
|
|
||||||
name: z
|
|
||||||
.string()
|
|
||||||
.min(2, {
|
|
||||||
message: "Name must be at least 2 characters."
|
|
||||||
})
|
|
||||||
.max(30, {
|
|
||||||
message: "Name must not be longer than 30 characters."
|
|
||||||
}),
|
|
||||||
method: z.enum(["wireguard", "newt", "local"])
|
|
||||||
});
|
|
||||||
|
|
||||||
type CreateSiteFormValues = z.infer<typeof createSiteFormSchema>;
|
|
||||||
|
|
||||||
const defaultValues: Partial<CreateSiteFormValues> = {
|
|
||||||
name: "",
|
|
||||||
method: "newt"
|
|
||||||
};
|
|
||||||
|
|
||||||
type CreateSiteFormProps = {
|
type CreateSiteFormProps = {
|
||||||
onCreate?: (site: SiteRow) => void;
|
onCreate?: (site: SiteRow) => void;
|
||||||
|
@ -97,6 +78,25 @@ export default function CreateSiteForm({
|
||||||
privateKey: string;
|
privateKey: string;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
|
const createSiteFormSchema = z.object({
|
||||||
|
name: z
|
||||||
|
.string()
|
||||||
|
.min(2, {
|
||||||
|
message: t('nameMin', {len: 2})
|
||||||
|
})
|
||||||
|
.max(30, {
|
||||||
|
message: t('nameMax', {len: 30})
|
||||||
|
}),
|
||||||
|
method: z.enum(["wireguard", "newt", "local"])
|
||||||
|
});
|
||||||
|
|
||||||
|
type CreateSiteFormValues = z.infer<typeof createSiteFormSchema>;
|
||||||
|
|
||||||
|
const defaultValues: Partial<CreateSiteFormValues> = {
|
||||||
|
name: "",
|
||||||
|
method: "newt"
|
||||||
|
};
|
||||||
|
|
||||||
const [siteDefaults, setSiteDefaults] =
|
const [siteDefaults, setSiteDefaults] =
|
||||||
useState<PickSiteDefaultsResponse | null>(null);
|
useState<PickSiteDefaultsResponse | null>(null);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from "@app/components/Credenza";
|
} from "@app/components/Credenza";
|
||||||
import { SiteRow } from "./SitesTable";
|
import { SiteRow } from "./SitesTable";
|
||||||
import CreateSiteForm from "./CreateSiteForm";
|
import CreateSiteForm from "./CreateSiteForm";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type CreateSiteFormProps = {
|
type CreateSiteFormProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { ColumnDef } from "@tanstack/react-table";
|
import { ColumnDef } from "@tanstack/react-table";
|
||||||
import { DataTable } from "@app/components/ui/data-table";
|
import { DataTable } from "@app/components/ui/data-table";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface DataTableProps<TData, TValue> {
|
interface DataTableProps<TData, TValue> {
|
||||||
columns: ColumnDef<TData, TValue>[];
|
columns: ColumnDef<TData, TValue>[];
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { formatAxiosError } from "@app/lib/api";
|
||||||
import { createApiClient } from "@app/lib/api";
|
import { createApiClient } from "@app/lib/api";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import CreateSiteFormModal from "./CreateSiteModal";
|
import CreateSiteFormModal from "./CreateSiteModal";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export type SiteRow = {
|
export type SiteRow = {
|
||||||
id: number;
|
id: number;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
InfoSections,
|
InfoSections,
|
||||||
InfoSectionTitle
|
InfoSectionTitle
|
||||||
} from "@app/components/InfoSection";
|
} from "@app/components/InfoSection";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type SiteInfoCardProps = {};
|
type SiteInfoCardProps = {};
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,7 @@ import { formatAxiosError } from "@app/lib/api";
|
||||||
import { createApiClient } from "@app/lib/api";
|
import { createApiClient } from "@app/lib/api";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const GeneralFormSchema = z.object({
|
|
||||||
name: z.string().nonempty("Name is required")
|
|
||||||
});
|
|
||||||
|
|
||||||
type GeneralFormValues = z.infer<typeof GeneralFormSchema>;
|
|
||||||
|
|
||||||
export default function GeneralPage() {
|
export default function GeneralPage() {
|
||||||
const { site, updateSite } = useSiteContext();
|
const { site, updateSite } = useSiteContext();
|
||||||
|
@ -47,6 +41,13 @@ export default function GeneralPage() {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const GeneralFormSchema = z.object({
|
||||||
|
name: z.string().nonempty(t('nameRequired'))
|
||||||
|
});
|
||||||
|
|
||||||
|
type GeneralFormValues = z.infer<typeof GeneralFormSchema>;
|
||||||
|
|
||||||
const form = useForm<GeneralFormValues>({
|
const form = useForm<GeneralFormValues>({
|
||||||
resolver: zodResolver(GeneralFormSchema),
|
resolver: zodResolver(GeneralFormSchema),
|
||||||
|
@ -55,7 +56,6 @@ export default function GeneralPage() {
|
||||||
},
|
},
|
||||||
mode: "onChange"
|
mode: "onChange"
|
||||||
});
|
});
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
async function onSubmit(data: GeneralFormValues) {
|
async function onSubmit(data: GeneralFormValues) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
BreadcrumbSeparator
|
BreadcrumbSeparator
|
||||||
} from "@app/components/ui/breadcrumb";
|
} from "@app/components/ui/breadcrumb";
|
||||||
import SiteInfoCard from "./SiteInfoCard";
|
import SiteInfoCard from "./SiteInfoCard";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
interface SettingsLayoutProps {
|
interface SettingsLayoutProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
|
|
@ -64,33 +64,7 @@ import {
|
||||||
} from "@app/components/ui/breadcrumb";
|
} from "@app/components/ui/breadcrumb";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { QRCodeCanvas } from "qrcode.react";
|
import { QRCodeCanvas } from "qrcode.react";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const createSiteFormSchema = z
|
|
||||||
.object({
|
|
||||||
name: z
|
|
||||||
.string()
|
|
||||||
.min(2, "Name must be at least 2 characters.")
|
|
||||||
.max(30, {
|
|
||||||
message: "Name must not be longer than 30 characters."
|
|
||||||
}),
|
|
||||||
method: z.enum(["newt", "wireguard", "local"]),
|
|
||||||
copied: z.boolean()
|
|
||||||
})
|
|
||||||
.refine(
|
|
||||||
(data) => {
|
|
||||||
if (data.method !== "local") {
|
|
||||||
return data.copied;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: "Please confirm that you have copied the config.",
|
|
||||||
path: ["copied"]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
type CreateSiteFormValues = z.infer<typeof createSiteFormSchema>;
|
|
||||||
|
|
||||||
type SiteType = "newt" | "wireguard" | "local";
|
type SiteType = "newt" | "wireguard" | "local";
|
||||||
|
|
||||||
|
@ -127,6 +101,32 @@ export default function Page() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const createSiteFormSchema = z
|
||||||
|
.object({
|
||||||
|
name: z
|
||||||
|
.string()
|
||||||
|
.min(2, { message: t('nameMin', {len: 2}) })
|
||||||
|
.max(30, {
|
||||||
|
message: t('nameMax', {len: 30})
|
||||||
|
}),
|
||||||
|
method: z.enum(["newt", "wireguard", "local"]),
|
||||||
|
copied: z.boolean()
|
||||||
|
})
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
if (data.method !== "local") {
|
||||||
|
return data.copied;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: t('sitesConfirmCopy'),
|
||||||
|
path: ["copied"]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
type CreateSiteFormValues = z.infer<typeof createSiteFormSchema>;
|
||||||
|
|
||||||
const [tunnelTypes, setTunnelTypes] = useState<
|
const [tunnelTypes, setTunnelTypes] = useState<
|
||||||
ReadonlyArray<TunnelTypeOption>
|
ReadonlyArray<TunnelTypeOption>
|
||||||
>([
|
>([
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { AxiosResponse } from "axios";
|
||||||
import SitesTable, { SiteRow } from "./SitesTable";
|
import SitesTable, { SiteRow } from "./SitesTable";
|
||||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
import SitesSplashCard from "./SitesSplashCard";
|
import SitesSplashCard from "./SitesSplashCard";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
type SitesPageProps = {
|
type SitesPageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
import { GetApiKeyResponse } from "@server/routers/apiKeys";
|
import { GetApiKeyResponse } from "@server/routers/apiKeys";
|
||||||
import ApiKeyProvider from "@app/providers/ApiKeyProvider";
|
import ApiKeyProvider from "@app/providers/ApiKeyProvider";
|
||||||
import { HorizontalTabs } from "@app/components/HorizontalTabs";
|
import { HorizontalTabs } from "@app/components/HorizontalTabs";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
interface SettingsLayoutProps {
|
interface SettingsLayoutProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
|
|
@ -56,35 +56,6 @@ import CopyTextBox from "@app/components/CopyTextBox";
|
||||||
import PermissionsSelectBox from "@app/components/PermissionsSelectBox";
|
import PermissionsSelectBox from "@app/components/PermissionsSelectBox";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const createFormSchema = z.object({
|
|
||||||
name: z
|
|
||||||
.string()
|
|
||||||
.min(2, {
|
|
||||||
message: "Name must be at least 2 characters."
|
|
||||||
})
|
|
||||||
.max(255, {
|
|
||||||
message: "Name must not be longer than 255 characters."
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
type CreateFormValues = z.infer<typeof createFormSchema>;
|
|
||||||
|
|
||||||
const copiedFormSchema = z
|
|
||||||
.object({
|
|
||||||
copied: z.boolean()
|
|
||||||
})
|
|
||||||
.refine(
|
|
||||||
(data) => {
|
|
||||||
return data.copied;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: "You must confirm that you have copied the API key.",
|
|
||||||
path: ["copied"]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
type CopiedFormValues = z.infer<typeof copiedFormSchema>;
|
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
const api = createApiClient({ env });
|
const api = createApiClient({ env });
|
||||||
|
@ -98,6 +69,35 @@ export default function Page() {
|
||||||
Record<string, boolean>
|
Record<string, boolean>
|
||||||
>({});
|
>({});
|
||||||
|
|
||||||
|
const createFormSchema = z.object({
|
||||||
|
name: z
|
||||||
|
.string()
|
||||||
|
.min(2, {
|
||||||
|
message: t('nameMin', {len: 2})
|
||||||
|
})
|
||||||
|
.max(255, {
|
||||||
|
message: t('nameMax', {len: 255})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
type CreateFormValues = z.infer<typeof createFormSchema>;
|
||||||
|
|
||||||
|
const copiedFormSchema = z
|
||||||
|
.object({
|
||||||
|
copied: z.boolean()
|
||||||
|
})
|
||||||
|
.refine(
|
||||||
|
(data) => {
|
||||||
|
return data.copied;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: t('apiKeysConfirmCopy2'),
|
||||||
|
path: ["copied"]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
type CopiedFormValues = z.infer<typeof copiedFormSchema>;
|
||||||
|
|
||||||
const form = useForm<CreateFormValues>({
|
const form = useForm<CreateFormValues>({
|
||||||
resolver: zodResolver(createFormSchema),
|
resolver: zodResolver(createFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AxiosResponse } from "axios";
|
||||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
import { ListRootApiKeysResponse } from "@server/routers/apiKeys";
|
import { ListRootApiKeysResponse } from "@server/routers/apiKeys";
|
||||||
import ApiKeysTable, { ApiKeyRow } from "./ApiKeysTable";
|
import ApiKeysTable, { ApiKeyRow } from "./ApiKeysTable";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
type ApiKeyPageProps = {};
|
type ApiKeyPageProps = {};
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default function IdpTable({ idps }: Props) {
|
||||||
const getTypeDisplay = (type: string) => {
|
const getTypeDisplay = (type: string) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "oidc":
|
case "oidc":
|
||||||
return t('idpOidc');
|
return "OAuth2/OIDC";
|
||||||
default:
|
default:
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,23 +45,6 @@ import { Badge } from "@app/components/ui/badge";
|
||||||
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const GeneralFormSchema = z.object({
|
|
||||||
name: z.string().min(2, "Name must be at least 2 characters."),
|
|
||||||
clientId: z.string().min(1, { message: "Client ID is required." }),
|
|
||||||
clientSecret: z.string().min(1, { message: "Client Secret is required." }),
|
|
||||||
authUrl: z.string().url({ message: "Auth URL must be a valid URL." }),
|
|
||||||
tokenUrl: z.string().url({ message: "Token URL must be a valid URL." }),
|
|
||||||
identifierPath: z
|
|
||||||
.string()
|
|
||||||
.min(1, { message: "Identifier Path is required." }),
|
|
||||||
emailPath: z.string().optional(),
|
|
||||||
namePath: z.string().optional(),
|
|
||||||
scopes: z.string().min(1, { message: "Scopes are required." }),
|
|
||||||
autoProvision: z.boolean().default(false)
|
|
||||||
});
|
|
||||||
|
|
||||||
type GeneralFormValues = z.infer<typeof GeneralFormSchema>;
|
|
||||||
|
|
||||||
export default function GeneralPage() {
|
export default function GeneralPage() {
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
const api = createApiClient({ env });
|
const api = createApiClient({ env });
|
||||||
|
@ -72,6 +55,24 @@ export default function GeneralPage() {
|
||||||
const { isUnlocked } = useLicenseStatusContext();
|
const { isUnlocked } = useLicenseStatusContext();
|
||||||
|
|
||||||
const redirectUrl = `${env.app.dashboardUrl}/auth/idp/${idpId}/oidc/callback`;
|
const redirectUrl = `${env.app.dashboardUrl}/auth/idp/${idpId}/oidc/callback`;
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const GeneralFormSchema = z.object({
|
||||||
|
name: z.string().min(2, { message: t('nameMin', {len: 2}) }),
|
||||||
|
clientId: z.string().min(1, { message: t('idpClientIdRequired') }),
|
||||||
|
clientSecret: z.string().min(1, { message: t('idpClientSecretRequired') }),
|
||||||
|
authUrl: z.string().url({ message: t('idpErrorAuthUrlInvalid') }),
|
||||||
|
tokenUrl: z.string().url({ message: t('idpErrorTokenUrlInvalid') }),
|
||||||
|
identifierPath: z
|
||||||
|
.string()
|
||||||
|
.min(1, { message: t('idpPathRequired') }),
|
||||||
|
emailPath: z.string().optional(),
|
||||||
|
namePath: z.string().optional(),
|
||||||
|
scopes: z.string().min(1, { message: t('idpScopeRequired') }),
|
||||||
|
autoProvision: z.boolean().default(false)
|
||||||
|
});
|
||||||
|
|
||||||
|
type GeneralFormValues = z.infer<typeof GeneralFormSchema>;
|
||||||
|
|
||||||
const form = useForm<GeneralFormValues>({
|
const form = useForm<GeneralFormValues>({
|
||||||
resolver: zodResolver(GeneralFormSchema),
|
resolver: zodResolver(GeneralFormSchema),
|
||||||
|
@ -89,8 +90,6 @@ export default function GeneralPage() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadIdp = async () => {
|
const loadIdp = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
BreadcrumbPage,
|
BreadcrumbPage,
|
||||||
BreadcrumbSeparator
|
BreadcrumbSeparator
|
||||||
} from "@app/components/ui/breadcrumb";
|
} from "@app/components/ui/breadcrumb";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
interface SettingsLayoutProps {
|
interface SettingsLayoutProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
@ -52,7 +52,7 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SettingsSectionTitle
|
<SettingsSectionTitle
|
||||||
title={t('idpSettings', { idpName: idp?.idp.name })}
|
title={t('idpSettings', { idpName: idp.idp.name })}
|
||||||
description={t('idpSettingsDescription')}
|
description={t('idpSettingsDescription')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -70,20 +70,6 @@ type Organization = {
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const policyFormSchema = z.object({
|
|
||||||
orgId: z.string().min(1, { message: "Organization is required" }),
|
|
||||||
roleMapping: z.string().optional(),
|
|
||||||
orgMapping: z.string().optional()
|
|
||||||
});
|
|
||||||
|
|
||||||
const defaultMappingsSchema = z.object({
|
|
||||||
defaultRoleMapping: z.string().optional(),
|
|
||||||
defaultOrgMapping: z.string().optional()
|
|
||||||
});
|
|
||||||
|
|
||||||
type PolicyFormValues = z.infer<typeof policyFormSchema>;
|
|
||||||
type DefaultMappingsValues = z.infer<typeof defaultMappingsSchema>;
|
|
||||||
|
|
||||||
export default function PoliciesPage() {
|
export default function PoliciesPage() {
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
const api = createApiClient({ env });
|
const api = createApiClient({ env });
|
||||||
|
@ -102,6 +88,20 @@ export default function PoliciesPage() {
|
||||||
const [showAddDialog, setShowAddDialog] = useState(false);
|
const [showAddDialog, setShowAddDialog] = useState(false);
|
||||||
const [editingPolicy, setEditingPolicy] = useState<PolicyRow | null>(null);
|
const [editingPolicy, setEditingPolicy] = useState<PolicyRow | null>(null);
|
||||||
|
|
||||||
|
const policyFormSchema = z.object({
|
||||||
|
orgId: z.string().min(1, { message: t('orgRequired') }),
|
||||||
|
roleMapping: z.string().optional(),
|
||||||
|
orgMapping: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultMappingsSchema = z.object({
|
||||||
|
defaultRoleMapping: z.string().optional(),
|
||||||
|
defaultOrgMapping: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
type PolicyFormValues = z.infer<typeof policyFormSchema>;
|
||||||
|
type DefaultMappingsValues = z.infer<typeof defaultMappingsSchema>;
|
||||||
|
|
||||||
const form = useForm<PolicyFormValues>({
|
const form = useForm<PolicyFormValues>({
|
||||||
resolver: zodResolver(policyFormSchema),
|
resolver: zodResolver(policyFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
@ -39,38 +39,6 @@ import { Badge } from "@app/components/ui/badge";
|
||||||
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const createIdpFormSchema = z.object({
|
|
||||||
name: z.string().min(2, "Name must be at least 2 characters."),
|
|
||||||
type: z.enum(["oidc"]),
|
|
||||||
clientId: z.string().min(1, { message: "Client ID is required." }),
|
|
||||||
clientSecret: z.string().min(1, { message: "Client Secret is required." }),
|
|
||||||
authUrl: z.string().url({ message: "Auth URL must be a valid URL." }),
|
|
||||||
tokenUrl: z.string().url({ message: "Token URL must be a valid URL." }),
|
|
||||||
identifierPath: z
|
|
||||||
.string()
|
|
||||||
.min(1, { message: "Identifier Path is required." }),
|
|
||||||
emailPath: z.string().optional(),
|
|
||||||
namePath: z.string().optional(),
|
|
||||||
scopes: z.string().min(1, { message: "Scopes are required." }),
|
|
||||||
autoProvision: z.boolean().default(false)
|
|
||||||
});
|
|
||||||
|
|
||||||
type CreateIdpFormValues = z.infer<typeof createIdpFormSchema>;
|
|
||||||
|
|
||||||
interface ProviderTypeOption {
|
|
||||||
id: "oidc";
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const providerTypes: ReadonlyArray<ProviderTypeOption> = [
|
|
||||||
{
|
|
||||||
id: "oidc",
|
|
||||||
title: "OAuth2/OIDC",
|
|
||||||
description: "Configure an OpenID Connect identity provider"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
const api = createApiClient({ env });
|
const api = createApiClient({ env });
|
||||||
|
@ -79,6 +47,38 @@ export default function Page() {
|
||||||
const { isUnlocked } = useLicenseStatusContext();
|
const { isUnlocked } = useLicenseStatusContext();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const createIdpFormSchema = z.object({
|
||||||
|
name: z.string().min(2, { message: t('nameMin', {len: 2}) }),
|
||||||
|
type: z.enum(["oidc"]),
|
||||||
|
clientId: z.string().min(1, { message: t('idpClientIdRequired') }),
|
||||||
|
clientSecret: z.string().min(1, { message: t('idpClientSecretRequired') }),
|
||||||
|
authUrl: z.string().url({ message: t('idpErrorAuthUrlInvalid') }),
|
||||||
|
tokenUrl: z.string().url({ message: t('idpErrorTokenUrlInvalid') }),
|
||||||
|
identifierPath: z
|
||||||
|
.string()
|
||||||
|
.min(1, { message: t('idpPathRequired') }),
|
||||||
|
emailPath: z.string().optional(),
|
||||||
|
namePath: z.string().optional(),
|
||||||
|
scopes: z.string().min(1, { message: t('idpScopeRequired') }),
|
||||||
|
autoProvision: z.boolean().default(false)
|
||||||
|
});
|
||||||
|
|
||||||
|
type CreateIdpFormValues = z.infer<typeof createIdpFormSchema>;
|
||||||
|
|
||||||
|
interface ProviderTypeOption {
|
||||||
|
id: "oidc";
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const providerTypes: ReadonlyArray<ProviderTypeOption> = [
|
||||||
|
{
|
||||||
|
id: "oidc",
|
||||||
|
title: "OAuth2/OIDC",
|
||||||
|
description: t('idpOidcDescription')
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
const form = useForm<CreateIdpFormValues>({
|
const form = useForm<CreateIdpFormValues>({
|
||||||
resolver: zodResolver(createIdpFormSchema),
|
resolver: zodResolver(createIdpFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { authCookieHeader } from "@app/lib/api/cookies";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
|
||||||
import IdpTable, { IdpRow } from "./AdminIdpTable";
|
import IdpTable, { IdpRow } from "./AdminIdpTable";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export default async function IdpPage() {
|
export default async function IdpPage() {
|
||||||
let idps: IdpRow[] = [];
|
let idps: IdpRow[] = [];
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { LicenseKeyCache } from "@server/license/license";
|
||||||
import { ArrowUpDown } from "lucide-react";
|
import { ArrowUpDown } from "lucide-react";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import CopyToClipboard from "@app/components/CopyToClipboard";
|
import CopyToClipboard from "@app/components/CopyToClipboard";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type LicenseKeysDataTableProps = {
|
type LicenseKeysDataTableProps = {
|
||||||
licenseKeys: LicenseKeyCache[];
|
licenseKeys: LicenseKeyCache[];
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
CredenzaHeader,
|
CredenzaHeader,
|
||||||
CredenzaTitle
|
CredenzaTitle
|
||||||
} from "@app/components/Credenza";
|
} from "@app/components/Credenza";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type SitePriceCalculatorProps = {
|
type SitePriceCalculatorProps = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
|
|
|
@ -54,17 +54,7 @@ import Link from "next/link";
|
||||||
import { Checkbox } from "@app/components/ui/checkbox";
|
import { Checkbox } from "@app/components/ui/checkbox";
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
|
||||||
import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
|
import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const formSchema = z.object({
|
|
||||||
licenseKey: z
|
|
||||||
.string()
|
|
||||||
.nonempty({ message: "License key is required" })
|
|
||||||
.max(255),
|
|
||||||
agreeToTerms: z.boolean().refine((val) => val === true, {
|
|
||||||
message: "You must agree to the license terms"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
function obfuscateLicenseKey(key: string): string {
|
function obfuscateLicenseKey(key: string): string {
|
||||||
if (key.length <= 8) return key;
|
if (key.length <= 8) return key;
|
||||||
|
@ -95,6 +85,18 @@ export default function LicensePage() {
|
||||||
const [isRecheckingLicense, setIsRecheckingLicense] = useState(false);
|
const [isRecheckingLicense, setIsRecheckingLicense] = useState(false);
|
||||||
const { supporterStatus } = useSupporterStatusContext();
|
const { supporterStatus } = useSupporterStatusContext();
|
||||||
|
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const formSchema = z.object({
|
||||||
|
licenseKey: z
|
||||||
|
.string()
|
||||||
|
.nonempty({ message: t('licenseKeyRequired') })
|
||||||
|
.max(255),
|
||||||
|
agreeToTerms: z.boolean().refine((val) => val === true, {
|
||||||
|
message: t('licenseTermsAgree')
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
@ -103,8 +105,6 @@ export default function LicensePage() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function load() {
|
async function load() {
|
||||||
setIsInitialLoading(true);
|
setIsInitialLoading(true);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
ColumnDef,
|
ColumnDef,
|
||||||
} from "@tanstack/react-table";
|
} from "@tanstack/react-table";
|
||||||
import { DataTable } from "@app/components/ui/data-table";
|
import { DataTable } from "@app/components/ui/data-table";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface DataTableProps<TData, TValue> {
|
interface DataTableProps<TData, TValue> {
|
||||||
columns: ColumnDef<TData, TValue>[];
|
columns: ColumnDef<TData, TValue>[];
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { toast } from "@app/hooks/useToast";
|
||||||
import { formatAxiosError } from "@app/lib/api";
|
import { formatAxiosError } from "@app/lib/api";
|
||||||
import { createApiClient } from "@app/lib/api";
|
import { createApiClient } from "@app/lib/api";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export type GlobalUserRow = {
|
export type GlobalUserRow = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { AdminListUsersResponse } from "@server/routers/user/adminListUsers";
|
||||||
import UsersTable, { GlobalUserRow } from "./AdminUsersTable";
|
import UsersTable, { GlobalUserRow } from "./AdminUsersTable";
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
|
||||||
import { InfoIcon } from "lucide-react";
|
import { InfoIcon } from "lucide-react";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
type PageProps = {
|
type PageProps = {
|
||||||
params: Promise<{ orgId: string }>;
|
params: Promise<{ orgId: string }>;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import ValidateOidcToken from "./ValidateOidcToken";
|
||||||
import { idp } from "@server/db/schemas";
|
import { idp } from "@server/db/schemas";
|
||||||
import db from "@server/db";
|
import db from "@server/db";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
params: Promise<{ orgId: string; idpId: string }>;
|
params: Promise<{ orgId: string; idpId: string }>;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { AxiosResponse } from "axios";
|
||||||
import { ExternalLink } from "lucide-react";
|
import { ExternalLink } from "lucide-react";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
import { cache } from "react";
|
import { cache } from "react";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `Auth - Pangolin`,
|
title: `Auth - Pangolin`,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { cleanRedirect } from "@app/lib/cleanRedirect";
|
||||||
import db from "@server/db";
|
import db from "@server/db";
|
||||||
import { idp } from "@server/db/schemas";
|
import { idp } from "@server/db/schemas";
|
||||||
import { LoginFormIDP } from "@app/components/LoginForm";
|
import { LoginFormIDP } from "@app/components/LoginForm";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|
|
@ -50,22 +50,6 @@ const requestSchema = z.object({
|
||||||
email: z.string().email()
|
email: z.string().email()
|
||||||
});
|
});
|
||||||
|
|
||||||
const formSchema = z
|
|
||||||
.object({
|
|
||||||
email: z.string().email({ message: "Invalid email address" }),
|
|
||||||
token: z.string().min(8, { message: "Invalid token" }),
|
|
||||||
password: passwordSchema,
|
|
||||||
confirmPassword: passwordSchema
|
|
||||||
})
|
|
||||||
.refine((data) => data.password === data.confirmPassword, {
|
|
||||||
path: ["confirmPassword"],
|
|
||||||
message: "Passwords do not match"
|
|
||||||
});
|
|
||||||
|
|
||||||
const mfaSchema = z.object({
|
|
||||||
code: z.string().length(6, { message: "Invalid code" })
|
|
||||||
});
|
|
||||||
|
|
||||||
export type ResetPasswordFormProps = {
|
export type ResetPasswordFormProps = {
|
||||||
emailParam?: string;
|
emailParam?: string;
|
||||||
tokenParam?: string;
|
tokenParam?: string;
|
||||||
|
@ -82,6 +66,7 @@ export default function ResetPasswordForm({
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [successMessage, setSuccessMessage] = useState<string | null>(null);
|
const [successMessage, setSuccessMessage] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
function getState() {
|
function getState() {
|
||||||
if (emailParam && !tokenParam) {
|
if (emailParam && !tokenParam) {
|
||||||
|
@ -99,6 +84,22 @@ export default function ResetPasswordForm({
|
||||||
|
|
||||||
const api = createApiClient(useEnvContext());
|
const api = createApiClient(useEnvContext());
|
||||||
|
|
||||||
|
const formSchema = z
|
||||||
|
.object({
|
||||||
|
email: z.string().email({ message: t('emailInvalid') }),
|
||||||
|
token: z.string().min(8, { message: t('tokenInvalid') }),
|
||||||
|
password: passwordSchema,
|
||||||
|
confirmPassword: passwordSchema
|
||||||
|
})
|
||||||
|
.refine((data) => data.password === data.confirmPassword, {
|
||||||
|
path: ["confirmPassword"],
|
||||||
|
message: t('passwordNotMatch')
|
||||||
|
});
|
||||||
|
|
||||||
|
const mfaSchema = z.object({
|
||||||
|
code: z.string().length(6, { message: t('pincodeInvalid') })
|
||||||
|
});
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
@ -123,8 +124,6 @@ export default function ResetPasswordForm({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
async function onRequest(data: z.infer<typeof requestSchema>) {
|
async function onRequest(data: z.infer<typeof requestSchema>) {
|
||||||
const { email } = data;
|
const { email } = data;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { cache } from "react";
|
||||||
import ResetPasswordForm from "./ResetPasswordForm";
|
import ResetPasswordForm from "./ResetPasswordForm";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,11 @@ import {
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@app/components/ui/card";
|
} from "@app/components/ui/card";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useTranslations } from "next-intl";
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export default async function ResourceNotFound() {
|
export default async function ResourceNotFound() {
|
||||||
|
|
||||||
const t = useTranslations();
|
const t = await getTranslations();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="w-full max-w-md">
|
<Card className="w-full max-w-md">
|
||||||
|
|
|
@ -31,7 +31,7 @@ import { createApiClient } from "@app/lib/api";
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type SignupFormProps = {
|
type SignupFormProps = {
|
||||||
redirect?: string;
|
redirect?: string;
|
||||||
|
|
|
@ -39,13 +39,6 @@ import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
import { cleanRedirect } from "@app/lib/cleanRedirect";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const FormSchema = z.object({
|
|
||||||
email: z.string().email({ message: "Invalid email address" }),
|
|
||||||
pin: z.string().min(8, {
|
|
||||||
message: "Your verification code must be 8 characters.",
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type VerifyEmailFormProps = {
|
export type VerifyEmailFormProps = {
|
||||||
email: string;
|
email: string;
|
||||||
redirect?: string;
|
redirect?: string;
|
||||||
|
@ -65,6 +58,13 @@ export default function VerifyEmailForm({
|
||||||
|
|
||||||
const api = createApiClient(useEnvContext());
|
const api = createApiClient(useEnvContext());
|
||||||
|
|
||||||
|
const FormSchema = z.object({
|
||||||
|
email: z.string().email({ message: t('emailInvalid') }),
|
||||||
|
pin: z.string().min(8, {
|
||||||
|
message: t('verificationCodeLengthRequirements'),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof FormSchema>>({
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
resolver: zodResolver(FormSchema),
|
resolver: zodResolver(FormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { Button } from "@app/components/ui/button";
|
import { Button } from "@app/components/ui/button";
|
||||||
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
import { useLicenseStatusContext } from "@app/hooks/useLicenseStatusContext";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
export default function LicenseViolation() {
|
export default function LicenseViolation() {
|
||||||
const { licenseStatus } = useLicenseStatusContext();
|
const { licenseStatus } = useLicenseStatusContext();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { ArrowRight, Plus } from "lucide-react";
|
import { ArrowRight, Plus } from "lucide-react";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
interface Organization {
|
interface Organization {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { XCircle } from "lucide-react";
|
import { XCircle } from "lucide-react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type InviteStatusCardProps = {
|
type InviteStatusCardProps = {
|
||||||
type: "rejected" | "wrong_user" | "user_does_not_exist" | "not_logged_in";
|
type: "rejected" | "wrong_user" | "user_does_not_exist" | "not_logged_in";
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { AxiosResponse } from "axios";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import InviteStatusCard from "./InviteStatusCard";
|
import InviteStatusCard from "./InviteStatusCard";
|
||||||
import { formatAxiosError } from "@app/lib/api";
|
import { formatAxiosError } from "@app/lib/api";
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export default async function InvitePage(props: {
|
export default async function InvitePage(props: {
|
||||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import LicenseStatusProvider from "@app/providers/LicenseStatusProvider";
|
||||||
import { GetLicenseStatusResponse } from "@server/routers/license";
|
import { GetLicenseStatusResponse } from "@server/routers/license";
|
||||||
import LicenseViolation from "./components/LicenseViolation";
|
import LicenseViolation from "./components/LicenseViolation";
|
||||||
import { cache } from "react";
|
import { cache } from "react";
|
||||||
import { NextIntlClientProvider } from 'next-intl';
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
import { getLocale } from 'next-intl/server';
|
import { getLocale } from "next-intl/server";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: `Dashboard - Pangolin`,
|
title: `Dashboard - Pangolin`,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from "next-intl/server";
|
||||||
|
|
||||||
export default async function NotFound() {
|
export default async function NotFound() {
|
||||||
|
|
||||||
|
|
|
@ -33,15 +33,10 @@ import {
|
||||||
} from "@app/components/ui/form";
|
} from "@app/components/ui/form";
|
||||||
import { Alert, AlertDescription } from "@app/components/ui/alert";
|
import { Alert, AlertDescription } from "@app/components/ui/alert";
|
||||||
import CreateSiteForm from "../[orgId]/settings/sites/CreateSiteForm";
|
import CreateSiteForm from "../[orgId]/settings/sites/CreateSiteForm";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type Step = "org" | "site" | "resources";
|
type Step = "org" | "site" | "resources";
|
||||||
|
|
||||||
const orgSchema = z.object({
|
|
||||||
orgName: z.string().min(1, { message: "Organization name is required" }),
|
|
||||||
orgId: z.string().min(1, { message: "Organization ID is required" })
|
|
||||||
});
|
|
||||||
|
|
||||||
export default function StepperForm() {
|
export default function StepperForm() {
|
||||||
const [currentStep, setCurrentStep] = useState<Step>("org");
|
const [currentStep, setCurrentStep] = useState<Step>("org");
|
||||||
const [orgIdTaken, setOrgIdTaken] = useState(false);
|
const [orgIdTaken, setOrgIdTaken] = useState(false);
|
||||||
|
@ -51,6 +46,11 @@ export default function StepperForm() {
|
||||||
const [isChecked, setIsChecked] = useState(false);
|
const [isChecked, setIsChecked] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const orgSchema = z.object({
|
||||||
|
orgName: z.string().min(1, { message: t('orgNameRequired') }),
|
||||||
|
orgId: z.string().min(1, { message: t('orgIdRequired') })
|
||||||
|
});
|
||||||
|
|
||||||
const orgForm = useForm<z.infer<typeof orgSchema>>({
|
const orgForm = useForm<z.infer<typeof orgSchema>>({
|
||||||
resolver: zodResolver(orgSchema),
|
resolver: zodResolver(orgSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
|
|
@ -42,14 +42,6 @@ import { QRCodeCanvas, QRCodeSVG } from "qrcode.react";
|
||||||
import { useUserContext } from "@app/hooks/useUserContext";
|
import { useUserContext } from "@app/hooks/useUserContext";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const enableSchema = z.object({
|
|
||||||
password: z.string().min(1, { message: "Password is required" })
|
|
||||||
});
|
|
||||||
|
|
||||||
const confirmSchema = z.object({
|
|
||||||
code: z.string().length(6, { message: "Invalid code" })
|
|
||||||
});
|
|
||||||
|
|
||||||
type Enable2FaProps = {
|
type Enable2FaProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
setOpen: (val: boolean) => void;
|
setOpen: (val: boolean) => void;
|
||||||
|
@ -68,6 +60,15 @@ export default function Enable2FaForm({ open, setOpen }: Enable2FaProps) {
|
||||||
const { user, updateUser } = useUserContext();
|
const { user, updateUser } = useUserContext();
|
||||||
|
|
||||||
const api = createApiClient(useEnvContext());
|
const api = createApiClient(useEnvContext());
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const enableSchema = z.object({
|
||||||
|
password: z.string().min(1, { message: t('passwordRequired') })
|
||||||
|
});
|
||||||
|
|
||||||
|
const confirmSchema = z.object({
|
||||||
|
code: z.string().length(6, { message: t('pincodeInvalid') })
|
||||||
|
});
|
||||||
|
|
||||||
const enableForm = useForm<z.infer<typeof enableSchema>>({
|
const enableForm = useForm<z.infer<typeof enableSchema>>({
|
||||||
resolver: zodResolver(enableSchema),
|
resolver: zodResolver(enableSchema),
|
||||||
|
@ -83,8 +84,6 @@ export default function Enable2FaForm({ open, setOpen }: Enable2FaProps) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
const request2fa = async (values: z.infer<typeof enableSchema>) => {
|
const request2fa = async (values: z.infer<typeof enableSchema>) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
|
|
|
@ -163,13 +163,15 @@ export default function PermissionsSelectBox({
|
||||||
onChange(updated);
|
onChange(updated);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<CheckboxWithLabel
|
<CheckboxWithLabel
|
||||||
variant="outlinePrimarySquare"
|
variant="outlinePrimarySquare"
|
||||||
id="toggle-all-permissions"
|
id="toggle-all-permissions"
|
||||||
label="Allow All Permissions"
|
label={t('permissionsAllowAll')}
|
||||||
checked={allPermissionsChecked}
|
checked={allPermissionsChecked}
|
||||||
onCheckedChange={(checked) =>
|
onCheckedChange={(checked) =>
|
||||||
toggleAllPermissions(checked as boolean)
|
toggleAllPermissions(checked as boolean)
|
||||||
|
@ -188,7 +190,7 @@ export default function PermissionsSelectBox({
|
||||||
<CheckboxWithLabel
|
<CheckboxWithLabel
|
||||||
variant="outlinePrimarySquare"
|
variant="outlinePrimarySquare"
|
||||||
id={`toggle-all-${category}`}
|
id={`toggle-all-${category}`}
|
||||||
label="Allow All"
|
label={t('allowAll')}
|
||||||
checked={allChecked}
|
checked={allChecked}
|
||||||
onCheckedChange={(checked) =>
|
onCheckedChange={(checked) =>
|
||||||
toggleAllInCategory(
|
toggleAllInCategory(
|
||||||
|
|
|
@ -50,13 +50,6 @@ import { Check, ExternalLink } from "lucide-react";
|
||||||
import confetti from "canvas-confetti";
|
import confetti from "canvas-confetti";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const formSchema = z.object({
|
|
||||||
githubUsername: z
|
|
||||||
.string()
|
|
||||||
.nonempty({ message: "GitHub username is required" }),
|
|
||||||
key: z.string().nonempty({ message: "Supporter key is required" })
|
|
||||||
});
|
|
||||||
|
|
||||||
export default function SupporterStatus() {
|
export default function SupporterStatus() {
|
||||||
const { supporterStatus, updateSupporterStatus } =
|
const { supporterStatus, updateSupporterStatus } =
|
||||||
useSupporterStatusContext();
|
useSupporterStatusContext();
|
||||||
|
@ -65,6 +58,14 @@ export default function SupporterStatus() {
|
||||||
const [purchaseOptionsOpen, setPurchaseOptionsOpen] = useState(false);
|
const [purchaseOptionsOpen, setPurchaseOptionsOpen] = useState(false);
|
||||||
|
|
||||||
const api = createApiClient(useEnvContext());
|
const api = createApiClient(useEnvContext());
|
||||||
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const formSchema = z.object({
|
||||||
|
githubUsername: z
|
||||||
|
.string()
|
||||||
|
.nonempty({ message: "GitHub username is required" }),
|
||||||
|
key: z.string().nonempty({ message: "Supporter key is required" })
|
||||||
|
});
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
|
@ -74,8 +75,6 @@ export default function SupporterStatus() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useTranslations();
|
|
||||||
|
|
||||||
async function hide() {
|
async function hide() {
|
||||||
await api.post("/supporter-key/hide");
|
await api.post("/supporter-key/hide");
|
||||||
|
|
||||||
|
@ -167,7 +166,7 @@ export default function SupporterStatus() {
|
||||||
title: t('error'),
|
title: t('error'),
|
||||||
description: formatAxiosError(
|
description: formatAxiosError(
|
||||||
error,
|
error,
|
||||||
"Failed to validate supporter key."
|
t('supportKeyErrorValidationDescription')
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { TagInputStyleClassesProps, type Tag as TagType } from "./tag-input";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { cn } from "@app/lib/cn";
|
import { cn } from "@app/lib/cn";
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type AutocompleteProps = {
|
type AutocompleteProps = {
|
||||||
tags: TagType[];
|
tags: TagType[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue