comparison unsubscribe/src/unsubscribe.html.luan @ 0:8f4df159f06b

start public repo
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 11 Jul 2025 20:57:49 -0600
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8f4df159f06b
1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error
3 local Io = require "luan:Io.luan"
4 local Http = require "luan:http/Http.luan"
5 local Shared = require "site:/lib/Shared.luan"
6 local head = Shared.head or error()
7 local header = Shared.header or error()
8 local footer = Shared.footer or error()
9 local validate_email = Shared.validate_email or error()
10 local Db = require "site:/lib/Db.luan"
11
12
13 return function()
14 local email = Http.request.parameters.email or error()
15 validate_email(email)
16 Db.run_in_transaction( function()
17 Db.delete("unsubscribe_email:"..email)
18 Db.save{
19 type = "unsubscribe"
20 unsubscribe_email = email
21 }
22 end )
23 Io.stdout = Http.response.text_writer()
24 %>
25 <!doctype html>
26 <html lang="en">
27 <head>
28 <% head() %>
29 <title>Link My Style</title>
30 </head>
31 <body>
32 <% header() %>
33 <div content>
34 <h1>Unsubscribed</h1>
35 <p><%=email%> has been unsubscribed from linkmy.style .</p>
36 <p>Unsubscribed by mistake? <a href="subscribe.html?email=<%=email%>">Subscribe</a></p>
37 </div>
38 <% footer() %>
39 </body>
40 </html>
41 <%
42 end