% @header [("title", ["Apply for membership"])] %>
<% if $"cmd" = "app" then
val name = $"name";
val rname = $"rname";
val email = $"email";
val forward = $"forward" <> "on";
val uses = $"uses";
val other = $"other";
if name = "" then
%>
Please enter a username
<%
elseif rname = "" then
%>Please enter your name
<%
elseif email = "" then
%>Please enter your contact e-mail address
<%
elseif uses = "" then
%>Please enter your proposed uses
<%
elseif not (App.validUser name) then
%>Invalid requested username
<%
elseif App.userExists name then
%>That username is already in use.<%
elseif not (App.validEmail email) then
%>Invalid e-mail address
<%
elseif not (App.apply { name = name, rname = rname, email = email,
forward = forward, uses = uses, other = other }) then
%>Error sending confirmation e-mail
<%
else
%>Application recorded
Check your e-mail for a message with further instructions.<%
end
else %>
<% end %>
<% @footer[] %>