fix: align user send mail behavior

This commit is contained in:
dreamhunter2333
2026-08-23 21:20:29 +08:00
parent 9109612322
commit 6800dfed3f
3 changed files with 49 additions and 2 deletions
+1 -2
View File
@@ -60,13 +60,12 @@ const send = async (c: Context<HonoCustomType>): Promise<Response> => {
if (address instanceof Response) {
return address;
}
const msgs = i18n.getMessagesbyContext(c);
try {
const reqJson = await c.req.json();
await sendMail(c, address, reqJson);
} catch (error) {
console.error("Failed to send user mail", error);
return c.text(msgs.OperationFailedMsg, 500);
return c.text(`Failed to send mail ${(error as Error).message}`, 400);
}
return c.json({ status: "ok" });
}
+4
View File
@@ -65,6 +65,10 @@ app.use('/*', async (c, next) => {
c.req.path.startsWith("/api/new_address")
|| c.req.path.startsWith("/api/send_mail")
|| c.req.path.startsWith("/external/api/send_mail")
|| (
c.req.path.startsWith("/user_api/address/")
&& c.req.path.endsWith("/send_mail")
)
|| c.req.path.startsWith("/user_api/register")
|| c.req.path.startsWith("/user_api/verify_code")
) {