view src/register2.html.luan @ 0:8f4df159f06b

start public repo
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 11 Jul 2025 20:57:49 -0600
parents
children
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
local Html = require "luan:Html.luan"
local html_encode = Html.encode or error()
local Io = require "luan:Io.luan"
local Http = require "luan:http/Http.luan"
local Shared = require "site:/lib/Shared.luan"
local head = Shared.head or error()
local page_header = Shared.page_header or error()
local footer = Shared.footer or error()
local User = require "site:/lib/User.luan"
local Logging = require "luan:logging/Logging.luan"
local logger = Logging.logger "register2.html"


return function()
	local user_name = Http.request.parameters.user
	if user_name == nil then
		Http.response.send_redirect "/register.html"
		return
	end
	local code = Http.request.parameters.code or ""
	local user = User.get_by_name(user_name) or error()
	Io.stdout = Http.response.text_writer()
%>
<!doctype html>
<html lang="en">
	<head>
<%		head() %>
		<title>Link My Style</title>
		<style>
			div[right_of_page] {
				background-image: url(/images/bag.jpg);
			}
			p[info] {
				color: #808080 !important;
			}
			[spam] {
				font-weight: bold;
				color: #ad1f00;
			}
		</style>
	</head>
	<body>
		<form page onsubmit="ajaxForm('/register2.js',this)" action="javascript:">
<%			page_header() %>
			<div>
				<input type=hidden name="user" value="<%=user_name%>">
				<h1>Enter confirmation code</h1>
				<p info>To verify your account, enter the six digit code we sent to <%=html_encode(user.email)%>.  <span spam>If you do not see our email, please check your spam folder for the email and report not spam.</span></p>
				<input type=text required name=code value="<%=code%>" placeholder="Enter 6-digit code" autofocus>
				<div error=code></div>
				<button type=submit big>Continue</button>
			</div>
<%			footer() %>
		</form>
		<div right_of_page></div>
	</body>
</html>
<%
end