Changeset

7815:f8d25a2e80ea

mod_register: Verify that fields are known to prevent traceback
author Kim Alvefur <zash@zash.se>
date Fri, 06 Jan 2017 13:09:09 +0100
parents 7814:2120d71b0d56
children 7816:2624f4ee34a2
files plugins/mod_register.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_register.lua	Fri Jan 06 13:07:22 2017 +0100
+++ b/plugins/mod_register.lua	Fri Jan 06 13:09:09 2017 +0100
@@ -63,6 +63,7 @@
 	if type(field) == "table" then
 		registration_form[#registration_form + 1] = field;
 	else
+	elseif field_map[field] or field_map[field:sub(1, -2) then
 		if field:match("%+$") then
 			field = field:sub(1, -2);
 			field_map[field].required = true;
@@ -70,6 +71,8 @@
 
 		registration_form[#registration_form + 1] = field_map[field];
 		registration_query:tag(field):up();
+	else
+		module:log("error", "Unknown field %q", field);
 	end
 end
 registration_query:add_child(registration_form:form());