Mercurial Hosting > freedit
diff src/login.html.luan @ 4:a17e400ddaa1
add email
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 21 Jun 2022 11:58:27 -0600 |
parents | fc3ee39d7764 |
children | 9166f6a14021 |
line wrap: on
line diff
--- a/src/login.html.luan Sun Jun 19 20:47:31 2022 -0600 +++ b/src/login.html.luan Tue Jun 21 11:58:27 2022 -0600 @@ -5,6 +5,7 @@ local Html = require "luan:Html.luan" local url_encode = Html.url_encode or error() local Io = require "luan:Io.luan" +local output_of = Io.output_of or error() local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() @@ -14,6 +15,7 @@ local Forum = require "site:/lib/Forum.luan" local forum_title = Forum.title or error() local User = require "site:/lib/User.luan" +local Mail = require "site:/lib/Mail.luan" local Db = require "site:/lib/Db.luan" local run_in_transaction = Db.run_in_transaction or error() @@ -85,10 +87,20 @@ end) elseif password == nil then local user = User.get_or_create_by_email(email) + local mailer = Mail.sender() or error "mail not configured" + mailer.send{ + From = forum_title.." <support@freedit.org>" + To = user.email + Subject = "Login" + body = output_of(function() %> +Login or register by clicking this link: + +<%=base_url()%>/login.html?email=<%=url_encode(email)%>&password=<%=user.password%> +<% end) + } page(function() %> <p>We have sent you an email. Please check your email to login or register.</p> - <p>hack - <a href="<%=base_url()%>/login.html?email=<%=url_encode(email)%>&password=<%=user.password%>">link</a></p> <% end) elseif name == nil then