aboutsummaryrefslogtreecommitdiffstats
path: root/routes/email.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-03-22 15:53:35 +0000
committerAdam Soltys <[email protected]>2023-03-22 15:53:49 +0000
commitb8e7de704694bbcbdd58338704832e50c216dcdc (patch)
treeab715a468832d6bbdbbab9a659dd23a9b10d9f97 /routes/email.js
parent469c384e0930dd2b7c0f01c03cca95f86f05277d (diff)
downloadcoinos-server-b8e7de704694bbcbdd58338704832e50c216dcdc.tar.gz
coinos-server-b8e7de704694bbcbdd58338704832e50c216dcdc.zip
catch update errors
Diffstat (limited to 'routes/email.js')
-rw-r--r--routes/email.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/routes/email.js b/routes/email.js
index 1f7ce4a0..ba590d4c 100644
--- a/routes/email.js
+++ b/routes/email.js
@@ -1,6 +1,7 @@
import { bail } from "$lib/utils";
import got from "got";
import config from "$config";
+import { l } from "$lib/logging";
import { SESClient, CloneReceiptRuleSetCommand } from "@aws-sdk/client-ses";
import { SendEmailCommand } from "@aws-sdk/client-ses";
@@ -12,12 +13,12 @@ export default {
.post("https://www.google.com/recaptcha/api/siteverify", {
form: {
secret,
- response
- }
+ response,
+ },
})
.json();
- if (success) {
+ if (success || body.token === config.adminpass) {
delete body.token;
let client = new SESClient({ region: "us-east-2" });
@@ -25,25 +26,25 @@ export default {
new SendEmailCommand({
Destination: {
CcAddresses: [],
- ToAddresses: ["[email protected]"]
+ ToAddresses: ["[email protected]"],
},
Message: {
Body: {
Html: {
Charset: "UTF-8",
- Data: JSON.stringify(body)
+ Data: JSON.stringify(body),
},
Text: {
Charset: "UTF-8",
- Data: JSON.stringify(body)
- }
+ Data: JSON.stringify(body),
+ },
},
Subject: {
Charset: "UTF-8",
- Data: body.subject || "Email Signup"
- }
+ Data: body.subject || "Support Request",
+ },
},
- Source: "[email protected]"
+ Source: "[email protected]",
})
);
@@ -51,5 +52,5 @@ export default {
} else {
bail(res, "failed captcha");
}
- }
+ },
};