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