Prevent invalid names from registering

For some reason the kore validators are broken.
It's nice to have proper error messages anyway I guess.
This commit is contained in:
Robin Malley 2020-10-17 20:03:40 +00:00
parent 3742a9d5c4
commit 86a14e9d62
1 changed files with 2 additions and 2 deletions

View File

@ -507,7 +507,7 @@ function claim(req)
--Get the page to claim a name
text = render(string.format("%s/_claim",domain),function()
print("cache miss, rendering claim page")
return pages.claim{}
return pages.claim{err=""}
end)
elseif method == "POST" then
--Actually claim a name
@ -515,7 +515,7 @@ function claim(req)
local name = assert(http_argument_get_string(req,"user"))
--What in the world, Kore should be rejecting names that
--are not lower case & no symbols, but some still get through somehow.
if not name:match("^[a-z0-9]{1,30}$") then
if not name:match("^[a-z0-9]*$") then
print("Bad username:",name)
text = pages.claim{
err = "Usernames must match ^[a-z0-9]{1,30}$"