From 8116c25e2fd53b572ef2ac415229875b0b1d5399 Mon Sep 17 00:00:00 2001 From: Daniele Teti Date: Mon, 9 Sep 2024 12:42:30 +0200 Subject: [PATCH] Updated TemplatePro --- samples/middleware_jwtblacklist/AppControllerU.pas | 3 ++- sources/TemplatePro.pas | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/samples/middleware_jwtblacklist/AppControllerU.pas b/samples/middleware_jwtblacklist/AppControllerU.pas index 71f85dcc..8dc5753c 100644 --- a/samples/middleware_jwtblacklist/AppControllerU.pas +++ b/samples/middleware_jwtblacklist/AppControllerU.pas @@ -54,7 +54,8 @@ var begin ContentType := TMVCMediaType.APPLICATION_JSON; lJObj := TJSONObject.Create; - lJObj.S['message'] := 'This is protected content accessible only by user1'; + lJObj.S['message'] := 'This is protected content accessible only by user1: you are ' + + Context.LoggedUser.UserName + ' logged since ' + DateTimeToStr(Context.LoggedUser.LoggedSince); lJArr := lJObj.A['querystringparameters']; lQueryParams := Context.Request.QueryStringParams; diff --git a/sources/TemplatePro.pas b/sources/TemplatePro.pas index 530021e3..a07d8945 100644 --- a/sources/TemplatePro.pas +++ b/sources/TemplatePro.pas @@ -2453,9 +2453,9 @@ begin GetVariables.Add(Name, TVarDataSource.Create(TJDOJsonObject(Value.AsObject), [viJSONObject])); end else - if Value.AsObject is TJDOJsonObject then + if Value.AsObject is TJDOJsonArray then begin - GetVariables.Add(Name, TVarDataSource.Create(TJDOJsonObject(Value.AsObject), [viJSONObject])); + raise ETProRenderException.Create('JSONArray cannot be used directly [HINT] Define a JSONObject variable with a JSONArray property'); end else begin