feat: enhance email configuration and validation features
- Implemented mutual exclusivity for SSL and TLS options in the email configuration. - Added comprehensive validation for required fields, port range, email format, and password requirements. - Updated the backend to support reversible encryption for SMTP passwords, ensuring secure handling of sensitive data. - Introduced loading states and improved user feedback in the email configuration UI for better user experience.
This commit is contained in:
@@ -229,6 +229,30 @@ export const getActiveEmailConfig = internalQuery({
|
||||
},
|
||||
});
|
||||
|
||||
// Query interna para obter configuração com senha descriptografada
|
||||
export const getActiveEmailConfigWithPassword = internalQuery({
|
||||
args: {},
|
||||
handler: async (ctx) => {
|
||||
const { decryptSMTPPassword } = await import("./auth/utils");
|
||||
const config = await ctx.db
|
||||
.query("configuracaoEmail")
|
||||
.withIndex("by_ativo", (q) => q.eq("ativo", true))
|
||||
.first();
|
||||
|
||||
if (!config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Descriptografar senha
|
||||
const senhaDescriptografada = await decryptSMTPPassword(config.senhaHash);
|
||||
|
||||
return {
|
||||
...config,
|
||||
senha: senhaDescriptografada,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export const markEmailEnviando = internalMutation({
|
||||
args: { emailId: v.id("notificacoesEmail") },
|
||||
returns: v.null(),
|
||||
|
||||
Reference in New Issue
Block a user