6
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Html = require "luan:Html.luan"
|
|
4 local url_encode = Html.url_encode or error()
|
|
5 local Io = require "luan:Io.luan"
|
|
6 local output_of = Io.output_of or error()
|
|
7 local Http = require "luan:http/Http.luan"
|
|
8 local Mail = require "site:/lib/Mail.luan"
|
|
9 local Api = require "site:/api/Api.luan"
|
|
10 local api = Api.api or error()
|
|
11 local user_error = Api.user_error or error()
|
|
12
|
|
13
|
|
14 return api(function()
|
|
15 local base_url = Http.request.parameters.base_url or user_error "missing base_url param"
|
|
16 local from = Http.request.parameters.from or user_error "missing from param"
|
58
|
17 local to = Http.request.parameters.to or user_error "missing to param"
|
6
|
18 local email = Http.request.parameters.email or user_error "missing email param"
|
|
19 local password = Http.request.parameters.password or user_error "missing password param"
|
|
20 local mailer = Mail.sender() or user_error "mail not configured"
|
|
21 mailer.send{
|
|
22 From = from
|
58
|
23 To = to
|
57
|
24 Subject = "Change Email"
|
6
|
25 body = output_of(function() %>
|
58
|
26 Change your email address to <%=email%> by clicking this link:
|
54
|
27
|
59
|
28 <%=base_url%>/change_email.html?email=<%=url_encode(email)%>&password=<%=password%>
|
58
|
29
|
|
30 If you don't want to change your email address, then don't click on the link.
|
6
|
31 <% end)
|
|
32 }
|
|
33 return {
|
|
34 okay = true
|
|
35 }
|
|
36 end)
|