liquid_feedback_frontend
diff app/main/api/profile.lua @ 1843:b01d9920371b
merge
author | jbe |
---|---|
date | Thu Feb 03 15:57:22 2022 +0100 (2022-02-03) |
parents | 757a87af4c83 |
children |
line diff
1.1 --- a/app/main/api/profile.lua Thu Feb 03 15:54:23 2022 +0100 1.2 +++ b/app/main/api/profile.lua Thu Feb 03 15:57:22 2022 +0100 1.3 @@ -17,6 +17,12 @@ 1.4 if value ~= nil and (field.type == "string" or field.type == "text") and json.type(value) ~= "string" then 1.5 return util.api_error(400, "Bad Request", "string_expected", "JSON encoded string value expected") 1.6 end 1.7 + if field.validate_func then 1.8 + local success = field.validate_func(field, fields) 1.9 + if not success then 1.10 + return util.api_error(403, "Forbidden", "validation_failure", "Request could not be validated") 1.11 + end 1.12 + end 1.13 profile.profile[field.id] = value 1.14 end 1.15 end