Mercurial Hosting > chat
view src/register.js.luan @ 117:e2deb5236f26
better login
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 04 Dec 2025 21:43:47 -0700 |
| parents | src/login.js.luan@7b339b1ccd11 |
| children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local send_mail_async = Shared.send_mail_async or error() local add_with = Shared.add_with or error() local Utils = require "site:/lib/Utils.luan" local to_list = Utils.to_list or error() local User = require "site:/lib/User.luan" return function() local email = Http.request.parameters.email or error() local user = User.get_or_create_by_email(email) local url = add_with( user.login_url() ) send_mail_async { To = email Subject = "Login" body = `%> Here is the link to login: <%= url %> Your password: <%=user.password%> <% ` } Io.stdout = Http.response.text_writer() %> location = '/register_sent.html'; <% end
