mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(dokploy): add webhook url for new users
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from "@/server/db/schema";
|
||||
import { WEBSITE_URL } from "@/server/utils/stripe";
|
||||
import {
|
||||
type Auth,
|
||||
IS_CLOUD,
|
||||
createAdmin,
|
||||
createUser,
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
getUserByToken,
|
||||
lucia,
|
||||
luciaToken,
|
||||
sendDiscordNotification,
|
||||
sendEmailNotification,
|
||||
updateAuthById,
|
||||
validateRequest,
|
||||
@@ -55,6 +57,7 @@ export const authRouter = createTRPCRouter({
|
||||
const newAdmin = await createAdmin(input);
|
||||
|
||||
if (IS_CLOUD) {
|
||||
await sendDiscordNotificationWelcome(newAdmin);
|
||||
await sendVerificationEmail(newAdmin.id);
|
||||
return true;
|
||||
}
|
||||
@@ -430,3 +433,26 @@ export const sendVerificationEmail = async (authId: string) => {
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export const sendDiscordNotificationWelcome = async (newAdmin: Auth) => {
|
||||
await sendDiscordNotification(
|
||||
{
|
||||
webhookUrl: process.env.DISCORD_WEBHOOK_URL || "",
|
||||
},
|
||||
{
|
||||
title: "✅ New User Registered",
|
||||
color: 0x00ff00,
|
||||
fields: [
|
||||
{
|
||||
name: "Email",
|
||||
value: newAdmin.email,
|
||||
inline: true,
|
||||
},
|
||||
],
|
||||
timestamp: newAdmin.createdAt,
|
||||
footer: {
|
||||
text: "Dokploy User Registration Notification",
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user