Finish e-mail sending; clickable tags
This commit is contained in:
parent
f67346231d
commit
d2836b92eb
12
smtpauth.lua
12
smtpauth.lua
@ -9,12 +9,12 @@ assert(Rand.ready())
|
|||||||
local DB = require"db"
|
local DB = require"db"
|
||||||
|
|
||||||
local function sendeml(raw)
|
local function sendeml(raw)
|
||||||
--[[local fn = "/tmp/ikibooru" .. DB.b256toreadable(Rand.bytes(16)) .. ".eml"
|
local fn = "/tmp/ikibooru" .. DB.b256toreadable(Rand.bytes(16)) .. ".eml"
|
||||||
local f = io.open(fn, "wb")
|
local f = io.open(fn, "wb")
|
||||||
f:write(raw)
|
f:write(raw)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
-- Send e-mail. Yes, this is crude.
|
-- Send e-mail. Yes, this is crude, but we have one thread.
|
||||||
io.popen("{ sendmail -t < " .. fn .. "; rm " .. fn .. "; } &", "r")]]
|
io.popen("{ sendmail -t < " .. fn .. "; rm " .. fn .. "; } &", "r")]]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -22,8 +22,6 @@ return {
|
|||||||
sendauthinfo = function(user)
|
sendauthinfo = function(user)
|
||||||
local url = BigGlobe.cfg.domain .."/verif?q=" .. Escapes.urlescape(DB.userauth(user))
|
local url = BigGlobe.cfg.domain .."/verif?q=" .. Escapes.urlescape(DB.userauth(user))
|
||||||
|
|
||||||
-- print(url)
|
|
||||||
|
|
||||||
if BigGlobe.cfg.anarchy == "ANARCHY" then
|
if BigGlobe.cfg.anarchy == "ANARCHY" then
|
||||||
return url
|
return url
|
||||||
else
|
else
|
||||||
@ -42,8 +40,6 @@ MIME-Version: 1.0
|
|||||||
sendregisterinfo = function(user)
|
sendregisterinfo = function(user)
|
||||||
local url = BigGlobe.cfg.domain .."/reg?q=" .. Escapes.urlescape(DB.userregcode(user))
|
local url = BigGlobe.cfg.domain .."/reg?q=" .. Escapes.urlescape(DB.userregcode(user))
|
||||||
|
|
||||||
print(url)
|
|
||||||
|
|
||||||
if BigGlobe.cfg.anarchy == "ANARCHY" then
|
if BigGlobe.cfg.anarchy == "ANARCHY" then
|
||||||
return url
|
return url
|
||||||
else
|
else
|
||||||
@ -53,9 +49,9 @@ Content-Type: text/html; charset=UTF-8
|
|||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html><body style="font-family:sans-serif;"><p>You have either registered or been invited to register at %s. Click on the below link to complete your registration.</p><p>If you have no idea what this is, consider whether your e-mail account has been compromised.</p><a href="%s"><div style="display:inline-block;font-size:1.2em;padding:0.5em 1em 0.5em 1em;border:1px solid gray;color:#C0C0C0;border-radius:6px;"><span>Complete</span></div></a></body></html>]], user.email, BigGlobe.cfg.sitename, BigGlobe.cfg.sitename, url))
|
<html><body style="font-family:sans-serif;"><p>You have either registered or been invited to register at %s. Click on the below link to complete your registration.</p><p>If you had not initiated a registration request, consider whether your e-mail account has been compromised.</p><a href="%s"><div style="display:inline-block;font-size:1.2em;padding:0.5em 1em 0.5em 1em;border:1px solid gray;color:#C0C0C0;border-radius:6px;"><span>Complete</span></div></a></body></html>]], user.email, BigGlobe.cfg.sitename, BigGlobe.cfg.sitename, url))
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -47,25 +47,22 @@ document.querySelector("div.tagbox span").onkeydown = function(ev) {
|
|||||||
}
|
}
|
||||||
} else if(ev.keyCode == 40) {
|
} else if(ev.keyCode == 40) {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
var sel = document.querySelector("div.autocomplete > div.tag.selected")
|
var alltags = Array.from(document.querySelectorAll("div.autocomplete div.tag"))
|
||||||
if(sel) {
|
var sel = alltags.findIndex(function(x) { return x.classList.contains("selected") })
|
||||||
sel.classList.toggle("selected")
|
if(sel != -1) alltags[sel].classList.toggle("selected")
|
||||||
sel = sel.nextElementSibling
|
sel = (sel + 1) % alltags.length
|
||||||
} else {
|
alltags[sel].classList.toggle("selected")
|
||||||
sel = document.querySelectorAll("div.autocomplete > div.tag")[0]
|
|
||||||
}
|
|
||||||
if(sel) sel.classList.toggle("selected")
|
|
||||||
} else if(ev.keyCode == 38) {
|
} else if(ev.keyCode == 38) {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
var sel = document.querySelector("div.autocomplete > div.tag.selected")
|
var alltags = Array.from(document.querySelectorAll("div.autocomplete div.tag"))
|
||||||
if(sel) {
|
var sel = alltags.findIndex(function(x) { return x.classList.contains("selected") })
|
||||||
sel.classList.toggle("selected")
|
if(sel != -1) {
|
||||||
sel = sel.previousElementSibling
|
alltags[sel].classList.toggle("selected")
|
||||||
|
sel = (sel + alltags.length - 1) % alltags.length
|
||||||
} else {
|
} else {
|
||||||
var asdf = document.querySelectorAll("div.autocomplete > div.tag")
|
sel = alltags.length - 1
|
||||||
sel = asdf[asdf.length - 1]
|
|
||||||
}
|
}
|
||||||
if(sel) sel.classList.toggle("selected")
|
alltags[sel].classList.toggle("selected")
|
||||||
} else if(ev.keyCode == 8 && !document.querySelector("div.tagbox span").innerText.length) {
|
} else if(ev.keyCode == 8 && !document.querySelector("div.tagbox span").innerText.length) {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
|
|
||||||
@ -96,7 +93,16 @@ document.querySelector("div.tagbox span").oninput = function(ev) {
|
|||||||
ac.innerText = "No such tags found"
|
ac.innerText = "No such tags found"
|
||||||
} else {
|
} else {
|
||||||
ajax.responseText.split("\n").slice(0, -1).forEach(function(line) {
|
ajax.responseText.split("\n").slice(0, -1).forEach(function(line) {
|
||||||
ac.insertBefore(createtag(line.split(",")[1], line.split(",")[2], line.split(",")[0]), null)
|
var tag = createtag(line.split(",")[1], line.split(",")[2], line.split(",")[0])
|
||||||
|
tag.onclick = function() {
|
||||||
|
var sel = document.querySelector("div.tag.selected")
|
||||||
|
if(sel) sel.classList.toggle("selected")
|
||||||
|
this.classList.toggle("selected")
|
||||||
|
var span = document.querySelector("div.tagbox span")
|
||||||
|
span.focus()
|
||||||
|
span.dispatchEvent(new KeyboardEvent('keydown', {bubbles: true, cancelable: true, keyCode: 13}))
|
||||||
|
}
|
||||||
|
ac.insertBefore(tag, null)
|
||||||
})
|
})
|
||||||
|
|
||||||
if(UnknownTagsMode) {
|
if(UnknownTagsMode) {
|
||||||
|
Loading…
Reference in New Issue
Block a user