mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
Merge pull request #2717 from Omar125X/fix/domain-validation
fix: improve domain and letsencrypt email validation
This commit is contained in:
@@ -36,7 +36,7 @@ import { api } from "@/utils/api";
|
||||
|
||||
const addServerDomain = z
|
||||
.object({
|
||||
domain: z.string(),
|
||||
domain: z.string().trim().toLowerCase(),
|
||||
letsEncryptEmail: z.string(),
|
||||
https: z.boolean().optional(),
|
||||
certificateType: z.enum(["letsencrypt", "none", "custom"]),
|
||||
@@ -49,7 +49,11 @@ const addServerDomain = z
|
||||
message: "Required",
|
||||
});
|
||||
}
|
||||
if (data.certificateType === "letsencrypt" && !data.letsEncryptEmail) {
|
||||
if (
|
||||
data.https &&
|
||||
data.certificateType === "letsencrypt" &&
|
||||
!data.letsEncryptEmail
|
||||
) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message:
|
||||
|
||||
@@ -225,9 +225,7 @@ export const settingsRouter = createTRPCRouter({
|
||||
}
|
||||
const user = await updateUser(ctx.user.ownerId, {
|
||||
host: input.host,
|
||||
...(input.letsEncryptEmail && {
|
||||
letsEncryptEmail: input.letsEncryptEmail,
|
||||
}),
|
||||
letsEncryptEmail: input.letsEncryptEmail,
|
||||
certificateType: input.certificateType,
|
||||
https: input.https,
|
||||
});
|
||||
|
||||
@@ -127,8 +127,6 @@ const { handler, api } = betterAuth({
|
||||
});
|
||||
}
|
||||
|
||||
console.log(user);
|
||||
|
||||
if (IS_CLOUD) {
|
||||
try {
|
||||
const hutk = getHubSpotUTK(
|
||||
|
||||
@@ -23,11 +23,18 @@ export const updateServerTraefik = (
|
||||
config.http.routers = config.http.routers || {};
|
||||
config.http.services = config.http.services || {};
|
||||
|
||||
// Get or create router config, but always update the rule with newHost
|
||||
const currentRouterConfig = config.http.routers[`${appName}-router-app`] || {
|
||||
rule: `Host(\`${newHost}\`)`,
|
||||
service: `${appName}-service-app`,
|
||||
entryPoints: ["web"],
|
||||
rule: `Host(\`${newHost}\`)`,
|
||||
};
|
||||
|
||||
// Always update the rule with the new host
|
||||
if (newHost) {
|
||||
currentRouterConfig.rule = `Host(\`${newHost}\`)`;
|
||||
}
|
||||
|
||||
config.http.routers[`${appName}-router-app`] = currentRouterConfig;
|
||||
|
||||
config.http.services = {
|
||||
|
||||
Reference in New Issue
Block a user