feat: Add SMTP password field for email
- Add an input field for SMTP password in the "Add Notification Channel" dialog. This field will be used for SMTP authentication.
This commit is contained in:
+18
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -75,6 +76,7 @@ const emailSchema = baseSchema.extend({
|
|||||||
email_sender_name: z.string().min(1, "Sender name is required"),
|
email_sender_name: z.string().min(1, "Sender name is required"),
|
||||||
smtp_server: z.string().min(1, "SMTP server is required"),
|
smtp_server: z.string().min(1, "SMTP server is required"),
|
||||||
smtp_port: z.string().min(1, "SMTP port is required"),
|
smtp_port: z.string().min(1, "SMTP port is required"),
|
||||||
|
smtp_password: z.string().min(1, "SMTP password is required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const webhookSchema = baseSchema.extend({
|
const webhookSchema = baseSchema.extend({
|
||||||
@@ -540,6 +542,22 @@ export const NotificationChannelDialog = ({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="smtp_password"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>SMTP Password</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="Enter your SMTP password" {...field} type="password" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
Password for authenticating with the SMTP server
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export interface AlertConfiguration {
|
|||||||
email_sender_name?: string;
|
email_sender_name?: string;
|
||||||
smtp_server?: string;
|
smtp_server?: string;
|
||||||
smtp_port?: string;
|
smtp_port?: string;
|
||||||
|
smtp_password?: string;
|
||||||
webhook_id?: string;
|
webhook_id?: string;
|
||||||
channel_id?: string;
|
channel_id?: string;
|
||||||
}
|
}
|
||||||
@@ -68,14 +69,13 @@ export const alertConfigService = {
|
|||||||
} else if (config.notification_type === "google_chat") {
|
} else if (config.notification_type === "google_chat") {
|
||||||
cleanConfig.google_chat_webhook_url = config.google_chat_webhook_url || "";
|
cleanConfig.google_chat_webhook_url = config.google_chat_webhook_url || "";
|
||||||
} else if (config.notification_type === "email") {
|
} else if (config.notification_type === "email") {
|
||||||
|
|
||||||
cleanConfig.email_address = config.email_address || "";
|
cleanConfig.email_address = config.email_address || "";
|
||||||
cleanConfig.email_sender_name = config.email_sender_name || "";
|
cleanConfig.email_sender_name = config.email_sender_name || "";
|
||||||
cleanConfig.smtp_server = config.smtp_server || "";
|
cleanConfig.smtp_server = config.smtp_server || "";
|
||||||
cleanConfig.smtp_port = config.smtp_port || "";
|
cleanConfig.smtp_port = config.smtp_port || "";
|
||||||
|
cleanConfig.smtp_password = config.smtp_password || "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await pb.collection('alert_configurations').create(cleanConfig);
|
const result = await pb.collection('alert_configurations').create(cleanConfig);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
|
|||||||
Reference in New Issue
Block a user