0
|
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 end )
|
|
19 Io.stdout = Http.response.text_writer()
|
|
20 %>
|
|
21 <!doctype html>
|
|
22 <html lang="en">
|
|
23 <head>
|
|
24 <% head() %>
|
|
25 <title>Link My Style</title>
|
|
26 </head>
|
|
27 <body>
|
|
28 <% header() %>
|
|
29 <div content>
|
|
30 <h1>Subscribed</h1>
|
|
31 <p><%=email%> has been subscribed to linkmy.style .</p>
|
|
32 <p><a href="unsubscribe.html?email=<%=email%>">Unsubscribe</a></p>
|
|
33 </div>
|
|
34 <% footer() %>
|
|
35 </body>
|
|
36 </html>
|
|
37 <%
|
|
38 end
|