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()
|
45
|
8 local User = require "site:/lib/User.luan"
|
|
9 local Db = require "site:/lib/Db.luan"
|
|
10 local run_in_transaction = Db.run_in_transaction or error()
|
0
|
11
|
|
12
|
|
13 return function()
|
45
|
14 local user_id = Http.request.parameters.user or error()
|
|
15 local password = Http.request.parameters.password or error()
|
|
16 run_in_transaction( function()
|
|
17 local user = User.get_by_id(user_id) or error()
|
|
18 user.password == password or error()
|
|
19 user.notify_email = nil
|
|
20 user.save()
|
|
21 end )
|
0
|
22 Io.stdout = Http.response.text_writer()
|
|
23 %>
|
|
24 <!doctype html>
|
|
25 <html>
|
|
26 <head>
|
|
27 <% head() %>
|
|
28 </head>
|
|
29 <body>
|
|
30 <% header() %>
|
|
31 <div content>
|
45
|
32 <h1>Unsubscribe</h1>
|
|
33 <p>You have been unsubscribed from notification emails.</p>
|
0
|
34 </div>
|
|
35 </body>
|
|
36 </html>
|
|
37 <%
|
|
38 end
|