diff unsubscribe/src/subscribe.html.luan @ 0:8f4df159f06b

start public repo
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 11 Jul 2025 20:57:49 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unsubscribe/src/subscribe.html.luan	Fri Jul 11 20:57:49 2025 -0600
@@ -0,0 +1,38 @@
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local Io = require "luan:Io.luan"
+local Http = require "luan:http/Http.luan"
+local Shared = require "site:/lib/Shared.luan"
+local head = Shared.head or error()
+local header = Shared.header or error()
+local footer = Shared.footer or error()
+local validate_email = Shared.validate_email or error()
+local Db = require "site:/lib/Db.luan"
+
+
+return function()
+	local email = Http.request.parameters.email or error()
+	validate_email(email)
+	Db.run_in_transaction( function()
+		Db.delete("unsubscribe_email:"..email)
+	end )
+	Io.stdout = Http.response.text_writer()
+%>
+<!doctype html>
+<html lang="en">
+	<head>
+<%		head() %>
+		<title>Link My Style</title>
+	</head>
+	<body>
+<%		header() %>
+		<div content>
+			<h1>Subscribed</h1>
+			<p><%=email%> has been subscribed to linkmy.style .</p>
+			<p><a href="unsubscribe.html?email=<%=email%>">Unsubscribe</a></p>
+		</div>
+<%		footer() %>
+	</body>
+</html>
+<%
+end