Files
ARCG-Remote-Station-Software/plugins/rms.auth.otp_email/index.js
OE6DXD e1a4ce0b8b initialize generic rms-software repository
Add the reusable RMS core application (server, web UI, plugins, tests, tools) with generic defaults, GPL licensing, and maintainer context documentation so deployments can consume this repo as software source independent of station-specific overlays.
2026-03-16 03:31:08 +01:00

33 lines
984 B
JavaScript

async function createPlugin(ctx) {
return {
async execute(action, input) {
if (action !== "send_challenge") {
throw new Error(`Unknown action: ${action}`);
}
const payload = input && input.payload ? input.payload : {};
const recipient = input && input.recipient ? String(input.recipient) : "";
if (!recipient) {
throw new Error("recipient missing");
}
const entry = {
at: new Date().toISOString(),
via: "rms.auth.otp_email",
to: recipient,
from: String(ctx.getSetting("from", ctx.env.SMTP_FROM || "noreply@arcg.at")),
subject: String(payload.subject || "ARCG OTP"),
text: String(payload.text || ""),
html: String(payload.html || "")
};
await ctx.appendMailOutbox(entry);
return { ok: true, delivered: true, transport: "otp-email-plugin" };
},
async health() {
return { ok: true };
}
};
}
module.exports = {
createPlugin
};