Mercurial Hosting > chat
diff src/invite.js.luan @ 56:323ddacc1593
start invite
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 04 Mar 2025 07:00:42 -0700 |
parents | |
children | 8270106644db |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/invite.js.luan Tue Mar 04 07:00:42 2025 -0700 @@ -0,0 +1,23 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local Parsers = require "luan:Parsers.luan" +local json_string = Parsers.json_string or error() +local Http = require "luan:http/Http.luan" +local Io = require "luan:Io.luan" +local User = require "site:/lib/User.luan" +local get_user_by_email = User.get_by_email or error() + + +return function() + local email = Http.request.parameters.email or error() + Io.stdout = Http.response.text_writer() + if get_user_by_email(email) ~= nil then +%> + location = '?with=<%=email%>'; +<% + return + end +%> + openInvite(<%=json_string(email)%>); +<% +end