ikibooru/login.html.l

56 lines
1.8 KiB
Plaintext

{%
local em = request.querystring.z and Escapes.urlspunescape(request.querystring.z)
local u
local worked = false
local zzz
if em and not verified then
worked = true
u = DB.getuserbyemail(em)
if u and u.privs ~= DB.USER_PRIVS_BANNED then
-- Signing in
zzz = SMTPAuth.sendauthinfo(u)
elseif not u and (BigGlobe.cfg.membexcl == BigGlobe.MEMBEXCL_PUBLIC_WITHAPPROVAL or BigGlobe.cfg.membexcl == BigGlobe.MEMBEXCL_PUBLIC_NOAPPROVAL) then
-- Public registration
zzz = SMTPAuth.sendregisterinfo(em)
else
worked = false
end
if BigGlobe.cfg.anarchy == "ANARCHY" then
if u and u.privs > DB.USER_PRIVS_APPROVED then
worked = false
end
if worked then
response:addHeader("Refresh", "3;url=" .. zzz)
response:statusCode(303)
end
end
end
title = BigGlobe.cfg.sitename .. " - Sign-in sent"
%}
{% function content() %}
{% if BigGlobe.cfg.anarchy == "ANARCHY" then %}
{% if worked and zzz then %}
<p>In anarchy mode, anyone can be anything. Please wait..</p>
<p>If that doesn't work, <a href="{{ Escapes.htmlescape(zzz) }}">click here</a>.</p>
{% else %}
<p>User doesn't exist.</p>
{% end %}
{% else %}
{% if worked then %}
<p>Link has been sent to {{ em and Escapes.htmlescape(em) }}. This page may be closed.</p>
{% else %}
<p>You are not authorized to register this account. {% if u and u.privs == DB.USER_PRIVS_BANNED then %}You have been banned.{% elseif BigGlobe.cfg.membexcl == BigGlobe.MEMBEXCL_MEMBERS_INVITE then %}This website is invite-only.{% elseif BigGlobe.cfg.membexcl == BigGlobe.MEMBEXCL_MODS_INVITE then %}Only moderators may invite.{% elseif BigGlobe.cfg.membexcl == BigGlobe.MEMBEXCL_ADMIN_INVITES then %}Only administrators may invite.{% end %}</p>
{% end %}
{% end %}
{% end %}
{# base.inc