From 86a14e9d62b7bca45f2f4ad72040f4816b0e820e Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Sat, 17 Oct 2020 20:03:40 +0000 Subject: [PATCH] Prevent invalid names from registering For some reason the kore validators are broken. It's nice to have proper error messages anyway I guess. --- src/lua/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua/init.lua b/src/lua/init.lua index d0b0c5f..2a971f7 100644 --- a/src/lua/init.lua +++ b/src/lua/init.lua @@ -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}$"